All Questions
Tagged with open-ended-function integer
6 questions
33
votes
26
answers
8k
views
Print 4 billion if statements
Recently (okay, December 2023, I'm a little late) there's been a meme going around about a program checking if a 32-bit unsigned integer is even or odd using four billion if statements:
...
22
votes
17
answers
3k
views
Don't repeat yourself
In this challenge you will be tasked with implementing a sequence of natural numbers such that:
Each number appears a natural number of times
No two numbers appear the same number of times
No two ...
16
votes
15
answers
1k
views
Encode integers with some others
Input a non-empty array of positive (greater than 0) integers. Output another non-empty array of positive integers which encode the input array. Output array does not use any numbers used in the input ...
28
votes
17
answers
3k
views
Give me odd, even, square, cube, prime and composite 3-digit numbers
Given a string which is guaranteed to be either odd, even, square, ...
71
votes
177
answers
11k
views
Print all integers
Write a program or function which will provably print all integers exactly once given infinite time and memory.
Possible outputs could be:
...
11
votes
8
answers
666
views
Bijective mapping from integers to a variable number of bits
A variable number of bits is an array of 0 or more bits. So [0, 1] is a variable number of bits, but so is [].
Write a function ...