Skip to content

Instantly share code, notes, and snippets.

@mchouza
Last active November 9, 2015 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchouza/50a4ce81ad345e2acba3 to your computer and use it in GitHub Desktop.
Save mchouza/50a4ce81ad345e2acba3 to your computer and use it in GitHub Desktop.
Twitter cubes puzzle

This is an attempt to quantify the "coincidence" shown by this tweet:

https://twitter.com/SciencePorn/status/663497649908260865

Writing some basic C code:

#include <stdio.h>

int main(void)
{
    for (int i = 0; i < 1000; i++)
        for (int j = 0; j < 1000; j++)
            for (int k = 0; k < 1000; k++)
                if (1000 * 1000 * i + 1000 * j + k ==
                    i * i * i + j * j * j + k * k * k)
                    printf( "%03d%03d%03d\n", i, j, k );
    return 0;
}

Compiling and running it:

mchouza@saturn:~/Desktop$ gcc -std=c99 -O3 abc.c -o abc
mchouza@saturn:~/Desktop$ time ./abc
000000000
000000001
166500333
296584415
333667000
333667001
334000667
710656413
828538472

real	0m0.791s
user	0m0.791s
sys	0m0.000s

So it's easy to find those values and some other ones. But how much of a coincidence is this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment