Skip to main content

Questions tagged [open-ended-function]

For challenges where an exact output is not required but some property must still be fulfilled.

24 votes
6 answers
3k views

Computing Pi with iF*ck

Objective Compute \$\pi\$ using nothing but \$i\$ (\$\sqrt{-1}\$). Guidelines ONLY exponentiation and multiplication may be used (i.e. \$i^i\$ or \$ii\$) No additional symbols may be used (so no ...
WarpPrime's user avatar
  • 521
8 votes
18 answers
1k views

Output five hundred different valid Roman numerals [closed]

Output any 500 different valid Roman numerals in the range 1 to 3999, in uppercase. Code golf.
Steve Bennett's user avatar
11 votes
5 answers
849 views

Show order equivalence between the rationals and the binary fractions

Write a function \$f\$ which takes rational numbers and gives binary fractions (rational numbers whose denominator is a power of two) which is bijective and preserves order. That means: Different ...
Wheat Wizard's user avatar
  • 103k
-5 votes
7 answers
486 views

Produce 2025 in any human language, without those characters in your code

It's 2025! Write a function/program that outputs this number in words. There are two twists: You can write it out in (almost) any human language (including English). None of the characters in your ...
Steve Bennett's user avatar
10 votes
2 answers
398 views

Make a pretty cryptic crossword grid

Write a function/program that generates an aesthetically pleasing square cryptic crossword grid for a given size N. You do not need to include numbers. The rules for aesthetically pleasing are: The ...
Steve Bennett's user avatar
6 votes
3 answers
648 views

Implement any rotation-invariant function on colored dodecahedrons

Each of a regular dodecahedron's 12 faces can be painted either red or blue. Your task is to implement a function \$f\$ that takes a painted dodecahedron (as 12 booleans, in whatever order and format ...
Karl's user avatar
  • 871
4 votes
3 answers
515 views

Operators modify in place, fix my expressions [closed]

I'm using a language "MutFk" where the basic operators like "+" and "*" actually modify the left hand side of the expression, and also return the modified version. For ...
mousetail's user avatar
  • 14.4k
14 votes
7 answers
937 views

Implement any 10-ary truth function with cyclic symmetry

Implement a function \$f\$ that takes 10 boolean inputs and returns a boolean. The only requirement on \$f\$ is that it satisfies the identity $$ f(x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8,x_9,x_{10})=f(x_2,...
Karl's user avatar
  • 871
33 votes
26 answers
9k 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: ...
emanresu A's user avatar
  • 46.2k
9 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 ...
anatolyg's user avatar
  • 14.1k
8 votes
12 answers
3k 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 ...
talex's user avatar
  • 927
0 votes
4 answers
335 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 ...
bigyihsuan's user avatar
  • 11.4k
9 votes
3 answers
294 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 ...
Parcly Taxel's user avatar
  • 4,739
6 votes
1 answer
453 views

Counterexample to Shapiro inequality

Input: A positive integer n such that n is even and greater than 12 or n is odd and greater ...
Lucenaposition's user avatar
11 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 ...
Tbw's user avatar
  • 3,023

15 30 50 per page
1
2 3 4 5
8