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

Challenge What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an int then turn it into it's binary value...

14 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Olin Lathrop‭

Question code-golf number
#3: Post edited by user avatar General Sebast1an‭ · 2021-09-03T08:07:33Z (over 2 years ago)
  • > Looks like this challenge has been well-received. The challenge will remain on this place. This quote block will be removed after some time, just left out as a notice.
  • # Challenge
  • What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an `int` then turn it into it's binary value.
  • - Take input of a non-negative decimal integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - This is <a class="badge is-tag">code-golf</a>, so the shortest program wins. Yep, not by language.
  • # Test Cases
  • ```none
  • n = 0
  • Output: 0
  • n = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
  • # Challenge
  • What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an `int` then turn it into it's binary value.
  • - Take input of a non-negative decimal integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - This is <a class="badge is-tag">code-golf</a>, so the shortest program wins. Yep, not by language.
  • # Test Cases
  • ```none
  • n = 0
  • Output: 0
  • n = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
#2: Post edited by user avatar General Sebast1an‭ · 2021-09-02T04:33:46Z (over 2 years ago)
  • > This challenge is currently in the beta. If given enough positivity, this challenge will remain here. If not, feel free to make changes and clear out misinformation in the [sandboxed post](https://codegolf.codidact.com/posts/283649/).
  • # Challenge
  • What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an `int` then turn it into it's binary value.
  • - Take input of a non-negative decimal integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - This is <a class="badge is-tag">code-golf</a>, so the shortest program wins. Yep, not by language.
  • # Test Cases
  • ```none
  • n = 0
  • Output: 0
  • n = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
  • > Looks like this challenge has been well-received. The challenge will remain on this place. This quote block will be removed after some time, just left out as a notice.
  • # Challenge
  • What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an `int` then turn it into it's binary value.
  • - Take input of a non-negative decimal integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - This is <a class="badge is-tag">code-golf</a>, so the shortest program wins. Yep, not by language.
  • # Test Cases
  • ```none
  • n = 0
  • Output: 0
  • n = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
#1: Initial revision by user avatar General Sebast1an‭ · 2021-08-30T16:24:27Z (over 2 years ago)
Make my value binary
> This challenge is currently in the beta. If given enough positivity, this challenge will remain here. If not, feel free to make changes and clear out misinformation in the [sandboxed post](https://codegolf.codidact.com/posts/283649/).

# Challenge

What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an `int` then turn it into it's binary value.

- Take input of a non-negative decimal integer and output its binary value/form.
- Any preceding zeros don't need to be outputted.
- This is <a class="badge is-tag">code-golf</a>, so the shortest program wins. Yep, not by language.

# Test Cases

```none
n = 0
Output: 0

n = 1
Output: 1

n = 5
Output: 101

n = 12
Output: 1100

n = 31
Output: 11111

n = 4096
Output: 1000000000000
```