Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges Make my value binary

jq, 48 bytes [while(.>0;./2|floor)]|map(.%2)|reverse|join("") Try it online! jq is the Language of the month for September! if the output is not required as per the question, join can be o...

posted 3y ago by Razetime‭  ·  edited 3y ago by Razetime‭

Answer
#2: Post edited by user avatar Razetime‭ · 2021-09-03T11:58:01Z (over 3 years ago)
  • # [jq], 48 bytes
  • [while(.>0;./2|floor)]|map(.%2)|reverse|join("")
  • [Try it online!][TIO-kt4ax6bd]
  • [jq]: https://stedolan.github.io/jq/
  • [TIO-kt4ax6bd]: https://tio.run/##yyr8/z@6PCMzJ1VDz87AWk/fqCYtJz@/SDO2JjexQENP1Uizpii1LLWoOLUmKz8zT0NJSfP/fyMA "jq – Try It Online"
  • jq is the Language of the month for September!
  • if the output is not required as per the question, `join` can be omitted.
  • # [jq], 48 bytes
  • [while(.>0;./2|floor)]|map(.%2)|reverse|join("")
  • [Try it online!][TIO-kt4ax6bd]
  • [jq]: https://stedolan.github.io/jq/
  • [TIO-kt4ax6bd]: https://jqplay.org/s/A4QBPwOyaB
  • jq is the Language of the month for September!
  • if the output is not required as per the question, `join` can be omitted.
#1: Initial revision by user avatar Razetime‭ · 2021-09-03T11:57:28Z (over 3 years ago)
# [jq], 48 bytes

    [while(.>0;./2|floor)]|map(.%2)|reverse|join("")

[Try it online!][TIO-kt4ax6bd]

[jq]: https://stedolan.github.io/jq/
[TIO-kt4ax6bd]: https://tio.run/##yyr8/z@6PCMzJ1VDz87AWk/fqCYtJz@/SDO2JjexQENP1Uizpii1LLWoOLUmKz8zT0NJSfP/fyMA "jq – Try It Online"

jq is the Language of the month for September!

if the output is not required as per the question, `join` can be omitted.