Robber's Thread here

In this challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and another value for all other positive integer inputs. Cops will then reveal the program in an answer keeping the number a secret. Robbers can crack an answer by finding the number.

Here's the catch: this is not , instead your score will be the secret number with a lower score being better. Obviously you cannot reveal your score while robbers are still trying to find it. An answer that has not been cracked one week after its posting may have its score revealed and be marked safe. Safe answers cannot be cracked.

It probably goes without saying but you should be able to score your answer. That is you should know exactly what value is accepted by your decision machine. Simply knowing that there is one is not enough.

Use of Cryptographic functions

Unlike most cops and robbers challenge which ask you not to use cryptographic functions, this challenge not only entirely allows them but encourages them. You are free to create answers in any way as long as you are trying to win. That being said, answers using other methods are also welcome here. The goal of the challenge is to win, and as long as you don't cheat nothing is off the table.

  • 1
    \$\begingroup\$ If you allow crytographic functions, I would recommend putting a time limit on programs. \$\endgroup\$ – Okx Aug 28 '17 at 17:15
  • 12
    \$\begingroup\$ I downvoted this challenge because, in most languages, it can be simply cracked using a mapping algorithm or a simple loop. I consider that a bit too easy for a cops-and-robbers challenge. \$\endgroup\$ – Mr. Xcoder Aug 28 '17 at 18:02
  • 2
    \$\begingroup\$ I feel like there are going to be a lot of cops who know one (probably the smallest) accepted value but don't know if there are more right answers or what they are. \$\endgroup\$ – histocrat Aug 28 '17 at 18:03
  • 12
    \$\begingroup\$ @Mr.Xcoder You are free to downvote however I will point out that that is kind of the point of the challenge and not in my opinion a flaw. The challenge is mostly fun for cops who have to make it as hard to brute force as possible by slowing down computation. More creative answers will should make brute forcing more and more difficult allowing them to use smaller and smaller numbers. \$\endgroup\$ – Sriotchilism O'Zaic Aug 28 '17 at 18:05
  • 1
    \$\begingroup\$ @WheatWizard I assume it would not be winning, but it would not be possible to crack e.g. a program that just compares the input to A(9,9) where A is the Ackerman function. \$\endgroup\$ – flawr Aug 28 '17 at 19:00

26 Answers 26


Tampio, Cracked

m:n tulos on luvun funktio tulostettuna m:ään, missä luku on x:n kerrottuna kahdella seuraaja, kun x on luku m:stä luettuna
x:n funktio on luku sadalla kerrottuna sadalla salattuna, missä luku on x alempana sadan seuraajaa tai nolla
x:n seuraajan edeltäjä on x
x:n negatiivisena edeltäjä on x:n seuraaja negatiivisena
nollan edeltäjä on yksi negatiivisena
x salattuna y:llä on örkin edeltäjä, missä örkki on x:n seuraajan seuraaja jaettuna y:llä korotettuna kahteen
sata on kiven kolo, missä kivi on kallio katkaistuna maanjäristyksestä
kallio on yhteenlasku sovellettuna mannerlaatan jäseniin ja tulivuoren jäseniin
tulivuori on nolla lisättynä kallioon
mannerlaatta on yksi lisättynä mannerlaattaan
maanjäristys on kallion törmäys
a:n lisättynä b:hen kolo on yhteenlasku kutsuttuna a:lla ja b:n kololla
tyhjyyden kolo on nolla
x:n törmäys on x tutkittuna kahdellatoista, missä kaksitoista on 15 ynnä 6
x ynnä y on y vähennettynä x:stä

Run with:

python3 suomi.py file.suomi --io

The instructions for installing the interpreter are included in the Github page. Please tell if you have any difficulties running this.

The program in pseudocode. The program performs very slowly because my interpreter is super inefficient. Also, I didn't use any opt-in optimizations available, which can reduce the evaluation time from several minutes to about 10 seconds.

  • 1
    \$\begingroup\$ Is there no online interpreter for Tampio? \$\endgroup\$ – Shaggy Aug 28 '17 at 19:15
  • \$\begingroup\$ @Shaggy Not yet, unfortunately. I should probably ask if it could be added to TIO. \$\endgroup\$ – fergusq Aug 28 '17 at 19:18
  • \$\begingroup\$ Cracked \$\endgroup\$ – Sriotchilism O'Zaic Aug 29 '17 at 16:37

Perl 6Cracked!

In a strict sense, this isn't an acceptable submission because it doesn't try very hard to win. Instead, it hopes to offer a pleasant puzzle.

It is a "pure math" program which is intended to be cracked by contemplation. I'm sure that you could bruteforce the solution (after cleaning up some sloppy programming I've purposefully committed), but for "full credit" (:--)), you should be able to explain what it does on the math grounds.

sub postfix:<!>(Int $n where $n >= 0)
	[*] 1 .. $n;

sub series($x)
	[+] (0 .. 107).map({ (i*($x % (8*π))) ** $_ / $_! });

sub prefix:<∫>(Callable $f)
	my $n = 87931;
	([+] (0 .. $n).map({
		π/$n * ($_ == 0 || $_ == $n ?? 1 !! 2) * $f(2*π * $_/$n)

sub f(Int $in where $in >= 0)
	∫ { series($_)**11 / series($in * $_) }

You are supposed to crack the function f(). (That's the function that takes one natural number and returns one of the two results.) Warning: As shown by @Nitrodon, the program actually behaves wrongly and "accepts" an infinite number of inputs. Since I have no idea of how to fix it, I just remark for the future solvers that the number I had in mind is less than 70000.

If you try to run this in TIO, it will time out. This is intentional. (Since it's not supposed to be run at all!)

Finally, I tried to write some reasonably clear code. You should be mostly able to read it fluently even if you're not familiar with the language. Only two remarks: the square brackets [op] mean reducing ("folding", in Haskell lingo) a list with the operator op; and the sub called postfix:<!> actually defines a postfix operator named ! (i. e. used like 5! -- it does exactly what you would expect). Similarly for the prefix:<∫> one.

I hope that somebody enjoys this one, but I'm not sure if I got the difficulty right. Feel free to bash me in the comments :—).

Try it online!


JavaScript, Cracked

I've obfuscated this as much as I can, to the point where it can't fit within this answer.

Try it here! Click Run, then type in console guess(n)

Returns undefined if you get the wrong answer, returns true otherwise.

Edit: Somehow I overlooked the part about my score being the number. Oh well, my number is very very big. Good luck solving it anyways.


Jelly, score: ...1 (cracked)


Try it online!

1Really expected me to reveal it? Come on! Oh well, it has a score of 134. There, I said it!

  • \$\begingroup\$ Cracked \$\endgroup\$ – Mr. Xcoder Aug 28 '17 at 17:59
  • \$\begingroup\$ @Mr.Xcoder It lived long... \$\endgroup\$ – Erik the Outgolfer Aug 28 '17 at 17:59
  • \$\begingroup\$ I just added Ç€G and the range 1...1000 as input :P \$\endgroup\$ – Mr. Xcoder Aug 28 '17 at 18:08
  • \$\begingroup\$ You saw the 5ȷ2_ part right? \$\endgroup\$ – Erik the Outgolfer Aug 28 '17 at 18:09
  • \$\begingroup\$ No, I didn't even look at the code lol. Just added the test suite and saw where the 1 is, then I have pasted the string from the beginning until the 1 in a Python script and counted the number of zeros before it... \$\endgroup\$ – Mr. Xcoder Aug 28 '17 at 18:22

Python 2 (cracked)

I wouldn't suggest brute force. Hope you like generators!

print~~[all([c[1](c[0](l))==h and c[0](l)[p]==c[0](p^q) for c in [(str,len)] for o in [2] for h in [(o*o*o+o/o)**o] for p,q in [(60,59),(40,44),(19,20),(63,58),(61,53),(12,10),(43,42),(1,3),(35,33),(37,45),(17,18),(32,35),(20,16),(22,30),(45,43),(48,53),(58,59),(79,75),(68,77)]] + [{i+1 for i in f(r[5])}=={j(i) for j in [q[3]] for i in l} for q in [(range,zip,str,int)] for r in [[3,1,4,1,5,9]] for g in [q[1]] for s in [[p(l)[i:i+r[5]] for p in [q[2]] for i in [r[5]*u for f in [q[0]] for u in f(r[5])]]] for l in s + g(*s) + [[z for y in [s[i+a][j:j+r[0]] for g in [q[0]] for a in g(r[0])] for z in y] for k in [[w*r[0] for i in [q[0]] for w in i(r[0])]] for i in k for j in k] for f in [q[0]]]) for l in [int(raw_input())]][0]

Try it online!

Outputs 1 for the correct number, 0 otherwise.

  • \$\begingroup\$ Cracked \$\endgroup\$ – Leaky Nun Aug 29 '17 at 11:06
  • \$\begingroup\$ @LeakyNun Wow, a bit faster than I expected. \$\endgroup\$ – Sisyphus Aug 29 '17 at 11:14
  • \$\begingroup\$ Finding a sudoku solver online isn't hard. \$\endgroup\$ – Leaky Nun Aug 29 '17 at 11:15
  • \$\begingroup\$ There's some problem with your sudoku checker: you checked the horizontal lines and the vertical lines alright, but you only checked the first three cells. \$\endgroup\$ – Leaky Nun Aug 29 '17 at 11:20
  • \$\begingroup\$ @LeakyNun You're right, an a should be i+a. I've fixed it, but it's cracked anyway shrug \$\endgroup\$ – Sisyphus Aug 29 '17 at 11:36

Haskell, cracked

This is purely based on arithmetic. Note that myfun is the actual function, while h is just a helper function.

h k = sum $ map (\x -> (x*x)**(-1) - 1/(x**(2-1/(fromIntegral k)))) [1..2*3*3*47*14593]
myfun inp | inp == (last $ filter (\k -> h k < (-7.8015e-5)  )[1..37*333667-1]) = 1
          | otherwise = 0

main = print $ show $ myfun 42 -- replace 42 with your input

Try it online!

  • \$\begingroup\$ The program must finish without error on all inputs. Does this even finish within a day on unlimited memory? \$\endgroup\$ – michi7x7 Aug 28 '17 at 20:47
  • \$\begingroup\$ You do need quite a bit of memory but you certainly don't need unlimited memory. It probably depends on the implementation and on on your hardware. But it is obviously designed to take some time to compute in order to make brute force attacks difficult and encourage analyzing the program. Good luck :) \$\endgroup\$ – flawr Aug 28 '17 at 22:09
  • \$\begingroup\$ Cracked? \$\endgroup\$ – Christian Sievers Aug 29 '17 at 2:28

Java, Cracked by Nitrodon

import java.math.BigDecimal;

public class Main {
    private static final BigDecimal A = BigDecimal.valueOf(4);
    private static final BigDecimal B = BigDecimal.valueOf(5, 1);
    private static final BigDecimal C = BigDecimal.valueOf(-191222921, 9);
    private static BigDecimal a;
    private static BigDecimal b;
    private static int c;

    private static boolean f(BigDecimal i, BigDecimal j, BigDecimal k, BigDecimal l, BigDecimal m) {
        return i.compareTo(j) == 0 && k.compareTo(l) >= 0 && k.compareTo(m) <= 0;

    private static boolean g(int i, int j, BigDecimal k) {
        c = (c + i) % 4;
        if (j == 0) {
            BigDecimal l = a; BigDecimal m = b;
            switch (c) {
                case 0: a = a.add(k); return f(C, b, B, l, a);
                case 1: b = b.add(k); return f(B, a, C, m, b);
                case 2: a = a.subtract(k); return f(C, b, B, a, l);
                case 3: b = b.subtract(k); return f(B, a, C, b, m);
                default: return false;
        } else {
            k = k.divide(A);
            return g(0, j, k) || g(1, j, k) || g(3, j, k) || g(3, j, k) || g(0, j, k) || g(1, j, k) || g(1, j, k) || g(3, j, k);

    private static boolean h(int i) {
        a = BigDecimal.ZERO; b = BigDecimal.ZERO; c = 0;
        return g(0, i, BigDecimal.ONE);

    public static void main(String[] args) {
        int i = Integer.valueOf(args[0]);
        System.out.println(!h(i) && h(i - 1) ? 1 : 0);

I wanted to try something different than the usual hash and random functions. You can pass the number as a command line argument. Outputs 1 if the correct number is given and 0 otherwise. For small numbers you can also try it online.


The main part of the program implements a variant of a very well known algorithm. Once you know what it does, you will be able to optimize the given program to calculate the secret number.


This program implements the traversal of the quadratic variant (type 2) of the well known Koch curve (image from Wikipedia):


The secret number is the first iteration which doesn't pass through the point (B, C). As correctly recognized by Nitrodon, except of the first iteration we can safely ignore the recursion of all parts of the curve, which don't pass through the given point. By changing a line in the original program accordingly, we can check the correct number even in the online interpreter.

  • \$\begingroup\$ Cracked, I think; the running time is too long to verify directly, but I checked with easier values and my crack seems to work. \$\endgroup\$ – Nitrodon Aug 30 '17 at 5:17

Pyth, Cracked by Erik the Outgolfer*

I tried to obfuscate this as much as possible.

hqQl+r@G7hZ@c." y|çEC#nZÙ¦Y;åê½9{ü/ãѪ#¤

Try it here!

*The number was 9.


Octave, score: ???

It's pretty much guaranteed that no other number will have the exact same 20 random numbers in the end of the list of 1e8 of numbers.

function val = cnr(num)
rand("seed", num);
randomints = randi(flintmax-1,1e4,1e4);
val = isequal(randomints(end+(-20:0))(:), ...

Outputs 1 for the secret number, 0 otherwise.

I ran this in Octave 4.2.0.

"Sleeps and other slowdowns can be removed when bruteforcing."

Good luck with that :)

  • \$\begingroup\$ it doesn't seem to even run on tio \$\endgroup\$ – Okx Aug 28 '17 at 17:59
  • 1
    \$\begingroup\$ @Okx It times out on TIO, but it does run in the desktop version. \$\endgroup\$ – Rɪᴋᴇʀ Aug 28 '17 at 18:01
  • 1
    \$\begingroup\$ Why the downvote? \$\endgroup\$ – Sriotchilism O'Zaic Aug 28 '17 at 18:32
  • 3
    \$\begingroup\$ @WheatWizard probably because it's theoretically possible that it has multiple numbers. Also, it's kinda boring tbh. I would have liked to see more mathy solutions, RNG is kinda boring. \$\endgroup\$ – Rɪᴋᴇʀ Aug 28 '17 at 18:36
  • 1
    \$\begingroup\$ @Riker But because you're guessing at a seed to the RNG, he's using the RNG itself as his function which is actually deterministic. But yeah, considering it's relying on the difficultly of inverting what you hope is a one-way function, one might as well, just encrypt a string "true" with a random number and then the challenge almost amounts to breaking whatever encryption scheme was chosen to discover the private key. \$\endgroup\$ – Shufflepants Aug 29 '17 at 18:12

Ly, score 239, cracked


Try it online!

I'm banking on nobody knowing Ly here, although I know how easily that could change... sweats


(1014750)1sp[l1+sp1-]              # meaningless code that counts up to 1014750 and discards the result
                     28^Rr         # range from 255 to 0
                          nI       # get the index from the range equal to the input
                            24^=   # check if it's 16
                                u; # print the result

Brain-Flak, score 1574 (cracked)


Try it online!



[[yes]P] sy [[no]P] sn [ly sp] sq [ln sp] sr [lp ss] st [ln ss] su
?  sa
la %
d 0 r 0
=q !=r
10 154 ^ 10 153 ^ +
d la r la
<t !<u
1 la 1 la
>s !>n

Try it online!

Note: This submission has been modified since it was submitted. The original submission (below) was invalid and cracked by Sleafar in the comments below. (An input of 1 gives rise to the output yes, but there is one other number that gives the same result.)

[[yes]P] sy [[no]P] sn [ly sp] sq [ln sp] sr
?  sa
la %
d 0 r 0
=q !=r
10 154 ^ 10 153 ^ +
d la r la
<p !<n

Try it online!

  • \$\begingroup\$ The online interpreter returns "yes" for the input "1". Does this count as cracked now? \$\endgroup\$ – Sleafar Aug 30 '17 at 3:47
  • \$\begingroup\$ @Sleafar Sigh...yes, that was a stupid mistake on my part. \$\endgroup\$ – John Gowers Aug 30 '17 at 6:34
  • \$\begingroup\$ However, that means that this challenge is now invalid, since there are two inputs that make it print yes, so I'm not sure if you're allowed to claim it. I'll add a corrected version to this post, but leave the original up in case you are. \$\endgroup\$ – John Gowers Aug 30 '17 at 6:44

Python 3, score: ???

There are already some answers with sha256 hashes. Here is one with modular exponentiation:

def f(n):
  if n>41597712107959907: return False
  for i in range(9569712): n=pow(3,n,41597712107959907)
  return n==26547443852658337

import sys
print("Enter secret number:")

f returns True iff n is the secret number.

  • \$\begingroup\$ This returns True for infinitely many values. \$\endgroup\$ – John Gowers Aug 30 '17 at 8:32
  • \$\begingroup\$ oh, you are right of course. it should return false when the input is larger than 41597712107959907. \$\endgroup\$ – Lukas Boersma Aug 30 '17 at 12:39
  • \$\begingroup\$ That's a good first step, but it's not necessarily enough to guarantee that there is only one solution. 3 is not a generator of the multiplicative group Z_41597712107959907*, which means that some numbers may have more than one logarithm to base 3, or none at all. It's plausible that there's some other path that gets you to 26547443852658337 in 9569712 steps. \$\endgroup\$ – John Gowers Aug 30 '17 at 12:55

Ruby, safe, score:


#!ruby -lnaF|
if /^#{eval [$F,0]*"**#{~/$/}+"}$/ && $_.to_i.to_s(36)=~/joe|tim/
  p true
  p false

Try it online!


The first conditional checks the input number for narcissism. The thread I originally wrote for was coincidentally bumped around the same time I posted this, but I guess nobody noticed. The second converts the number to base 36, which uses letters as digits, and checks if the string contains "joe" or "tim". It can be proven (through exhaustion) that there is only one narcissistic number named either Joe or Tim (Joe), because the narcissistic numbers are finite. Proof that they're finite: the result of taking an n-digit number, raising each digit to the nth power, and summing is bounded above by n*9^n, while the value of an n-digit number is bounded below by n^10. The ratio between these terms is n*(9/10)^n, which eventually decreases monotonically as n increases. Once it falls below 1, there can be no n-digit narcissistic numbers.


PHP, safe, score:



$a = $argv[1];

$b ='0123456789abcdefghijklmnopqrstuvwxyz';

$c = strlen($b);

$d = '';
$e = $a;
while ($e) {
    $d .= $b[$e % $c];
    $e = floor($e / $c);

echo ((function_exists($d) && $d($a) === '731f62943ddf6733f493a812fc7aeb7ec07d97b6') ? 1 : 0) . "\n";

Outputs 1 if correct, 0 otherwise.

Edit: I don't think anyone even tried to crack this because:

it would be easy to brute force.


I take the input and convert it to "base 36", but I don't reverse the remainders to produce the final number. The number 60256 is "1ahs" in base 36. Unreversed, that is "sha1", which is a function in PHP. The final check is that sha1(60256) equals the hash.


Swift 3 (53 bytes) - Cracked

func f(n:Int){print(n==1+Int(.pi*123456.0) ?222:212)}

How to run this? – f(n:1).

Test Here.

  • \$\begingroup\$ Cracked \$\endgroup\$ – Mr. Xcoder Aug 28 '17 at 18:34
  • \$\begingroup\$ @Mr.Xcoder Heh well done, guess it was too easy \$\endgroup\$ – user70974 Aug 28 '17 at 18:35

Python 3, score: ???

Hopefully this, if anything, demonstrates how broken of a problem this really is:

from hashlib import sha3_512

hash_code = 'c9738b1424731502e1910f8289c98ccaae93d2a58a74dc3658151f43af350bec' \

def inc_string(string):
    length = len(string)
    if length == 0 or all(char == '\xFF' for char in string):
        return '\x00' * (length + 1)
    new_string = ''
    carry = True
    for i, char in enumerate(string[::-1]):
        if char == '\xFF' and carry:
            new_string = '\x00' + new_string
            carry = True
        elif carry:
            new_string = chr(ord(char) + 1) + new_string
            carry = False
        if not carry:
            new_string = string[0:~i] + new_string
    return new_string

def strings():
    string = ''
    while True:
        yield string
        string = inc_string(string)

def hash_string(string):
    return sha3_512(string.encode('utf-8')).hexdigest()

def main():
    for string in strings():
        if hash_string(string) == hash_code:


Essentially, what this code does is lazily generate every string possible until one of the strings has a hash that exactly matches hash_code above. The unhashed code takes the basic form of:

num = int(input('Enter a number:\n'))
if num == <insert number here>:

Except <insert number here> is replaced with a number and there are comments in the code for the purpose of making the code nearly unguessable.

I've taken every precaution to ensure that I do not benefit from this post. For starters, it's community wiki so I will not gain rep for it. Also, my score is rather large, so hopefully a much more creative answer will come along and win.

Hope you all aren't too furious at my response, I just wanted to show off why cops and robbers posts usually ban hashing algorithms.

  • \$\begingroup\$ Input is taken from stdin. Output is a 1 (for a correctly guessed number) or a 0 (for an incorrectly guessed one). \$\endgroup\$ – sonar235 Aug 28 '17 at 23:54
  • \$\begingroup\$ I don't know why you have made this a community wiki. This is your answer that looks like it took considerable work to make. I certainly wouldn't call this answer evidence of the question being broken either. This is a clever answer, that could likely score well, (I can't even prove this doesn't work for 1). The point of a question is always to attract answers that approach the question in clever interesting ways (and also to have fun but I can't vouch for your entertainment), and as far as I'm concerned this does that. \$\endgroup\$ – Sriotchilism O'Zaic Aug 29 '17 at 0:01
  • 3
    \$\begingroup\$ In fact this answer is invalid. It will almost certainly (with astronomical probability of no string of length 512 bits matching the hash) exec() something else that probably isn't even valid python code before reaching the intended code. \$\endgroup\$ – Joshua Aug 29 '17 at 18:03
  • 1
    \$\begingroup\$ @sonar235: Your fragment template has more than 512 bits in it. \$\endgroup\$ – Joshua Aug 29 '17 at 19:28
  • 1
    \$\begingroup\$ To expand on Joshua's answer: your bit of code is 102 characters long. In particular, your program will iterate over every 100-character string before it gets to your code. Since your code iterates over characters in the range 0x00-0xFF, that is 256 ^ 100 or 2 ^ 800 strings. Meanwhile, there are only 2 ^ 512 possible 512-bit hashes. That means that the strings you iterate over outnumber the possible hashes at least 2 ^ 288 to one - a number 10,000 times greater than the number of atoms in the universe. The probability of that particular hash going unused is incredibly small. \$\endgroup\$ – John Gowers Aug 29 '17 at 21:55

Python 3, 49 bytes, Cracked by sonar235

x = input()
print(int(x)*2 == int(x[-1]+x[0:-1]))

Try it online!

  • \$\begingroup\$ Zero is not a postive integer fyi. I don't know if that was the intended solution but it does work. \$\endgroup\$ – Sriotchilism O'Zaic Aug 28 '17 at 21:43
  • \$\begingroup\$ 0 is not the intended solution. \$\endgroup\$ – E.D. Aug 28 '17 at 21:44
  • 8
    \$\begingroup\$ Uhh, your TIO page is showing the solution... \$\endgroup\$ – LyricLy Aug 28 '17 at 22:20
  • 2
    \$\begingroup\$ Also "write a program or function that outputs one value when provided the number as input and another value for all other positive integer inputs" \$\endgroup\$ – Jonathan Allan Aug 28 '17 at 22:50
  • 2
    \$\begingroup\$ Cracked by @Sonar235. \$\endgroup\$ – Dom Hastings Aug 29 '17 at 7:26

Java, score: 3141592 (Cracked)

  • 1
    \$\begingroup\$ I don't think the obfuscation is going to do anything except add an annoying first step. \$\endgroup\$ – Engineer Toast Aug 29 '17 at 19:09
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$ – pppery Aug 29 '17 at 19:11
  • 2
    \$\begingroup\$ @EngineerToast no, not really, it was purely for scaring off lazy people. \$\endgroup\$ – user902383 Aug 29 '17 at 19:40

Python 3, score 1 (safe)

Not a very interesting solution, but better a safe cop than a dead cop.

import hashlib

def sha(x):
    return hashlib.sha256(x).digest()

x = input().encode()
original = x

for _ in range(1000000000):
    x = sha(x)

print(int(x==b'3\xdf\x11\x81\xd4\xfd\x1b\xab19\xbd\xc0\xc3|Y~}\xea83\xaf\xa5\xb4]\xae\x15wN*!\xbe\xd5' and int(original.decode())<1000))

Outputs 1 for the target number, 0 otherwise. Input is taken from stdin. The last part (and int(original.decode())<1000) exists only to ensure only one answer, otherwise there would obviously be infinitely many answers.

  • 1
    \$\begingroup\$ Can you add a TIO link, please? \$\endgroup\$ – Shaggy Aug 28 '17 at 19:14
  • 1
    \$\begingroup\$ For future robbers: The integer doesn't seem to be in smaller than 100000000. \$\endgroup\$ – Mr. Xcoder Aug 28 '17 at 19:16
  • 1
    \$\begingroup\$ @Shaggy It will timeout on TIO, it took about half an hour on my computer to run the billion iterations of SHA256. \$\endgroup\$ – L3viathan Aug 28 '17 at 19:54
  • 2
    \$\begingroup\$ Any robbers fancy forming a team to solve this one? We just need to split the numbers less than 1000 up among us so we have time to compute the iterated-SHA digests before the deadline. \$\endgroup\$ – John Gowers Aug 29 '17 at 22:05
  • 1
    \$\begingroup\$ @JohnGowers do you know BOINC? I would run that. \$\endgroup\$ – NieDzejkob Sep 1 '17 at 16:36

C (gcc), score ???

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <wmmintrin.h>

#include <openssl/bio.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>

union State
    uint8_t u8[128];
    __m128i i128[8];
} state;

void encrypt()
    BIO *key = BIO_new_mem_buf
        "-----BEGIN PUBLIC KEY-----\n"
        "-----END PUBLIC KEY-----\n",

    RSA *rsa = PEM_read_bio_RSA_PUBKEY(key, &rsa, NULL, NULL);

    uint8_t ciphertext[128];

    RSA_public_encrypt(128, state.u8, ciphertext, rsa, RSA_NO_PADDING);
    memcpy(state.u8, ciphertext, 128);

void verify()
    if (memcmp

static inline void quarterround(int offset)
    int dest = (offset + 1) % 8, src = offset % 8;

    state.i128[dest] = _mm_aesenc_si128(state.i128[src], state.i128[dest]);

int main(int argc, char *argv[])
    if (argc != 2)

    uint64_t input = strtoull(argv[1], NULL, 0);

    state.i128[0] = _mm_set_epi32(0, 0, input >> 32, input);

    for (uint64_t round = 0; round < 0x1p45; round += 2)



Since cryptographic solutions are encouraged, here. Exactly one positive integer will print something, all others will print nothing. This takes a long time, so it cannot be tested online.


Java, 164517378918, safe

import java.math.*;import java.util.*;
public class T{
    static boolean f(BigInteger i){if(i.compareTo(BigInteger.valueOf(2).pow(38))>0)return false;if(i.longValue()==0)return false;if(i.compareTo(BigInteger.ONE)<0)return false;int j=i.multiply(i).hashCode();for(int k=3^3;k<2000;k+=Math.abs(j%300+1)){j+=1+(short)k+i.hashCode()%(k+1);}return i.remainder(BigInteger.valueOf(5*(125+(i.hashCode()<<11))-7)).equals(BigInteger.valueOf(0));}
    public static void main(String[]a){long l=new Scanner(System.in).nextLong();boolean b=false;for(long j=1;j<10;j++){b|=f(BigInteger.valueOf(l-j));}System.out.println(f(BigInteger.valueOf(l))&&b);}

TI-BASIC, score: 196164532 non-competing

Returns 1 for secret number, 0 otherwise.


Refer to the note on this page on the rand command for more info.

  • 8
    \$\begingroup\$ Is this guaranteed to have exactly one matching input number? \$\endgroup\$ – Rɪᴋᴇʀ Aug 29 '17 at 15:20
  • \$\begingroup\$ @Riker: I think the TI calculator uses some kind of floating point internally; if RAND uses the same floating point as the rest of it, I'm pretty sure there's only 1 solution. \$\endgroup\$ – Joshua Sep 3 '17 at 15:23
  • \$\begingroup\$ @Joshua I believe it uses L'Ecuyer's Algorithm. \$\endgroup\$ – kamoroso94 Sep 3 '17 at 15:30
  • \$\begingroup\$ @Joshua "pretty sure" isn't enough. Unless you can prove that only 1 solution exists, this isn't a valid answer. \$\endgroup\$ – Rɪᴋᴇʀ Sep 3 '17 at 16:26
  • 1
    \$\begingroup\$ @Dennis: Probe for 196164532*2; if that's not a solution than there is no other solution. \$\endgroup\$ – Joshua Sep 9 '17 at 3:06

Python 3, score:?

def check(x):
    if x < 0 or x >= 5754820589765829850934909 or pow(x, 18446744073709551616, 5754820589765829850934909) != 2093489574700401569580277 or x % 4 != 1:
        return "No way ;-("
    return "Cool B-)"

Try it online!

Simple, but may take some time to brute-force ;-) Looking forward to a fast crack ;-)

Footnote: the first two and the last conditions make the answer unique.

BTW how the score is calculated?

Hint 1

You may expect there will be 264 answers within 0 <= x < [the 25-digit prime], but actually there are only 4, and the last condition eliminates the other 3. If you can crack this, then you will also know the other 3 solutions.


Aceto, safe


Outputs TrueFalse if correct, FalseFalse otherwise

The number was


Try it online!


C#, Mono, Linux, Alpha, score 1 (safe)

class Program
public static void Main()
//Excluding out-of-range inputs at ppperry's request; does not change solution
//original code:
//var bytes = System.BitConverter.GetBytes((long)int.Parse(System.Console.ReadLine()));
int i;
if (!int.TryParse(System.Console.ReadLine(), out i || i <= 0 || i > 1000000) { System.Console.WriteLine(0); Environment.Exit(0); }
var bytes = System.BitConverter.GetBytes((long)i);
using (var x = System.Security.Cryptography.HashAlgorithm.Create("MD5"))
    for (int i = 0; i < 1000000; ++i)
            for (int j = 0; j < 86400; ++j)
                    bytes = x.ComputeHash(bytes);
if (bytes[0] == 91 && bytes[1] == 163 && bytes[2] == 41 && bytes[3] == 169)

Careful. I mean it. There's plenty of alpha simulators out there. Use one with a jitter or this won't finish.

This depends on the fact that Alpha is big-endian, causing System.BitConverter to do the wrong thing if somebody tries this on x86 or x64. I wrote this answer to demonstrate the badness of the challenge more than anything else.

  • 1
    \$\begingroup\$ This can't have exactly one solution; there are an infinite number of integers, and the MD5 function has a finite number of possible outputs, so there must be a collision \$\endgroup\$ – pppery Aug 29 '17 at 19:16
  • \$\begingroup\$ @ppperry: There are only 2 billion and change positive ints though. \$\endgroup\$ – Joshua Aug 29 '17 at 19:24
  • \$\begingroup\$ If you think about it that way, this errors on inputs greater than 2^31, and thus is invalid. \$\endgroup\$ – pppery Aug 29 '17 at 19:34
  • \$\begingroup\$ @ppperry: There now it won't error on that. \$\endgroup\$ – Joshua Aug 29 '17 at 19:42
  • 2
    \$\begingroup\$ Unless you can prove that 1 is the only solution, this answer is invalid. The burden of proof should be on the person claiming to have a valid answer. \$\endgroup\$ – Dennis Sep 6 '17 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.