All Questions
Tagged with open-ended-function code-golf
104
questions
30
votes
25
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:
...
8
votes
10
answers
2k
views
Figure out which of your friends reveals confidential information to the media!
Exposition
You send secret information to 100 of your friends, and the next day you discover that the information has been published! Who could have revealed it?
To determine that, you number your ...
8
votes
12
answers
2k
views
Tic-tac-toe encode them all
I decided to create a complete guide to the great game of tic-tac-toe.
I expected it to be extremely popular, so to save on paper while printing it I decided to encode all possible game positions.
I ...
0
votes
4
answers
265
views
Implement a Monad
A monad is a type that wraps another type, that represents the available operations on the wrapped type. Monads have the following associated operations, where M is ...
9
votes
3
answers
238
views
Convert to Chomsky normal form
Let a context-free language be specified by its production rules and start symbol, e.g.
S -> AbB | C
C -> b | c
B -> AA | AC
A -> a | ε
Here and in the ...
10
votes
4
answers
2k
views
Output a 1-2-3-5-7... sequence
Follow-up of my previous challenge, inspired by @emanresu A's question, and proven possible by @att (Mathematica solution linked)
For the purposes of this challenge, a 1-2-3-5-7... sequence is an ...
21
votes
15
answers
2k
views
Output a 1-2-3 sequence
For the purposes of this challenge, a 1-2-3 sequence is an infinite sequence of increasing positive integers such that for any positive integer \$n\$, exactly one of \$n, 2n,\$ and \$3n\$ appears in ...
12
votes
7
answers
2k
views
Horsey sightseeing
A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. For those who are not aware of how knights in chess work, knights are capable of ...
19
votes
9
answers
997
views
Output an infinitely proportional sequence
In this challenge, an infinitely proportional sequence is defined as a infinite sequence of positive integers such that:
All positive integers are contained infinitely many times within the sequence.
...
17
votes
12
answers
1k
views
Encode the input to exclude a given character (part 1)
Your task is to write 2 functions/programs. They may share code.
The first function must, given a string and a character, output a new string that does not contain that character.
The second function ...
6
votes
0
answers
218
views
Give the best Chaitin incompleteness bound
This was originally a pure mathematics question, but I think I've got the best chance for an answer here.
The Challenge
For concreteness, consider Peano Arithmetic (PA). For some language L of your ...
10
votes
9
answers
2k
views
Make a super fair number
An even distribution number is a number such that if you select any of it's digits at random the probability of it being any particular value (e.g. 0 or ...
16
votes
3
answers
466
views
Convert numbers to dice patterns
The way points are assigned on a dice follows a regular pattern, the center dot is present if and only if the number is odd. To represent the even numbers, pairs of dots on opposite sides of the ...
19
votes
22
answers
3k
views
Be big more often
Related
You are a manager at a large number factory. You want to show everyone your business is doing well, by showing randomly chosen samples. Unfortunately, your business is not doing that well. But ...
16
votes
5
answers
758
views
Prefix code generator
In this challenge, we consider an encoding from positive integers (up to a limit) to binary sequences. Some examples:
...