Skip to content

Instantly share code, notes, and snippets.

@Xion
Created February 11, 2012 21:54
Show Gist options
  • Save Xion/1804474 to your computer and use it in GitHub Desktop.
Save Xion/1804474 to your computer and use it in GitHub Desktop.
A neat little numerical puzzle
This puzzle is (allegedly) solved by elementary school children in 5 to 10 minutes,
but adults usually struggle with it much longer.
8809=6
7111=0
2172=0
6666=4
1111=0
3213=0
7662=2
9313=1
0000=4
2222=0
3333=0
5555=0
8193=3
8096=5
7777=0
9999=4
7756=1
6855=3
9881=5
5531=0
2581=?
(Bonus: Write a program that computes this function)
(Hint #1: It's language-agnostic. Actual numbers matter, not their names.)
(Hint #2: The program would take like 3-4 lines tops in most languages.)
(Hint #3: The function does not have well-defined value for certain class of inputs.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment