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 »
Sandbox

Post History

60%
+1 −0
Sandbox Make my value binary [released]

posted 3y ago by General Sebast1an‭  ·  edited 1y ago by trichoplax‭

#14: Post edited by user avatar trichoplax‭ · 2023-07-06T13:33:05Z (over 1 year ago)
Add finalized tag now that the sandbox can be filtered to exclude tags
Make my value binary [released]
# 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.
- <s>Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)</s> (Won't be in the final draft)
- <s>Adding to the disallowed converters, any built-in method that formats the variable as binary without actual conversion like Python's `0b` are also not allowed. The focus is to take input, make a converter, then output the result.</s> (Won't be in the final draft)
- 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
```
#13: Post edited by user avatar General Sebast1an‭ · 2021-09-02T04:33:44Z (over 3 years ago)
  • Make my value binary [in test (beta)]
  • Make my value binary [released]
#12: Post edited by user avatar General Sebast1an‭ · 2021-08-30T16:24:29Z (over 3 years ago)
  • Make my value binary
  • Make my value binary [in test (beta)]
#11: Post edited by user avatar General Sebast1an‭ · 2021-08-25T23:31:26Z (over 3 years ago)
  • # 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.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - Adding to the disallowed converters, any built-in method that formats the variable as binary without actual conversion like Python's `0b` are also not allowed. The focus is to take input, make a converter, then output the result.
  • - 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.
  • - <s>Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)</s> (Won't be in the final draft)
  • - <s>Adding to the disallowed converters, any built-in method that formats the variable as binary without actual conversion like Python's `0b` are also not allowed. The focus is to take input, make a converter, then output the result.</s> (Won't be in the final draft)
  • - 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
  • ```
#10: Post edited by user avatar General Sebast1an‭ · 2021-08-25T04:28:22Z (over 3 years ago)
  • # 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 integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - 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.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - Adding to the disallowed converters, any built-in method that formats the variable as binary without actual conversion like Python's `0b` are also not allowed. The focus is to take input, make a converter, then output the result.
  • - 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
  • ```
#9: Post edited by user avatar General Sebast1an‭ · 2021-08-24T10:12:10Z (over 3 years ago)
  • # Challenge
  • What's 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 integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - 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 integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - 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
  • ```
#8: Post edited by user avatar General Sebast1an‭ · 2021-08-24T07:13:16Z (over 3 years ago)
#7: Post edited by user avatar General Sebast1an‭ · 2021-08-23T21:47:53Z (over 3 years ago)
  • # Challenge
  • What's 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 an integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - 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
  • n = <any negative integer>
  • Output: Whatever you want, could be 0.
  • ```
  • # Challenge
  • What's 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 integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - 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
  • ```
#6: Post edited by user avatar General Sebast1an‭ · 2021-08-23T09:12:20Z (over 3 years ago)
  • # Challenge
  • What's 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 an integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.
  • - 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
  • n = <any negative integer>
  • Output: Whatever you want, could be 0.
  • ```
  • # Challenge
  • What's 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 an integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.](https://codegolf.codidact.com/comments/thread/4166#comment-12893)
  • - 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
  • n = <any negative integer>
  • Output: Whatever you want, could be 0.
  • ```
#5: Post edited by user avatar General Sebast1an‭ · 2021-08-23T09:11:35Z (over 3 years ago)
  • # Challenge
  • What's 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 an 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
  • n = <any negative integer>
  • Output: Whatever you want, could be 0.
  • ```
  • # Challenge
  • What's 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 an integer and output its binary value/form.
  • - Any preceding zeros don't need to be outputted.
  • - Suggested by [**@celtschk**](https://codegolf.codidact.com/users/8056): [Converters that simply take the inputted number as binary without changing the input itself aren't allowed.
  • - 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
  • n = <any negative integer>
  • Output: Whatever you want, could be 0.
  • ```
#4: Post edited by user avatar General Sebast1an‭ · 2021-08-23T08:28:41Z (over 3 years ago)
  • # Challenge
  • What's 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 an 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 = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
  • # Challenge
  • What's 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 an 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
  • n = <any negative integer>
  • Output: Whatever you want, could be 0.
  • ```
#3: Post edited by user avatar General Sebast1an‭ · 2021-08-23T08:26:52Z (over 3 years ago)
  • # Challenge
  • What's 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 an integer named $n$ 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 = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
  • # Challenge
  • What's 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 an 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 = 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-08-23T06:36:34Z (over 3 years ago)
  • # Challenge
  • What's 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 an integer named $n$ and output its binary value.
  • - 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 = 1
  • Output: 1
  • n = 5
  • Output: 101
  • n = 12
  • Output: 1100
  • n = 31
  • Output: 11111
  • n = 4096
  • Output: 1000000000000
  • ```
  • # Challenge
  • What's 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 an integer named $n$ 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 = 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-23T06:35:41Z (over 3 years ago)
Make my value binary
# Challenge

What's 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 an integer named $n$ and output its binary value.
- 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 = 1
Output: 1

n = 5
Output: 101

n = 12
Output: 1100

n = 31
Output: 11111

n = 4096
Output: 1000000000000
```