Can anyone provide me List of prime numbers which are sum of the cubes of three natural numbers

elementary-number-theorynumber theoryprime numbers

Pierre de Fermat discovered that if $p$ is a prime and congruent to 1 mod 4, then it can be written as the sum of the square of two natural numbers.

Similarly, I was trying to find the list of those prime numbers which are sum of the cubes of three natural numbers.

My Attempt:

$\begin{align}\qquad
3 &= 1^3+1^3+1^3 \\
17 &= 1^3+2^3+2^3 \\
29 &= 3^3+1^3+1^3 \\
73 &= 4^3+2^3+1^3 \\
\end{align}$

My idea was to find at least 100 such prime numbers so that I can observe the common property hold by them.

So before observing such things, I need list of such prime number because I don't have any computer program to develop such a list.

Question:
Can anyone provide me wit a list of prime numbers which are the sum of the cubes of three natural numbers?

Best Answer

Here is a complete list up to $10\,000$ which are $159$ primes. The $100$-th entry is $5641 = 17^3 + 8^3 + 6^3$.

For reference, I attached the brute-force Sage script at the end.

3:  [[1, 1, 1]]
17:  [[2, 2, 1]]
29:  [[3, 1, 1]]
43:  [[3, 2, 2]]
73:  [[4, 2, 1]]
127:  [[5, 1, 1]]
179:  [[5, 3, 3]]
197:  [[5, 4, 2]]
251:  [[5, 5, 1], [6, 3, 2]]
277:  [[5, 5, 3]]
281:  [[6, 4, 1]]
307:  [[6, 4, 3]]
349:  [[6, 5, 2]]
359:  [[7, 2, 2]]
397:  [[7, 3, 3]]
433:  [[6, 6, 1]]
521:  [[8, 2, 1]]
547:  [[8, 3, 2]]
557:  [[6, 6, 5]]
577:  [[8, 4, 1]]
593:  [[7, 5, 5]]
701:  [[8, 5, 4]]
757:  [[9, 3, 1]]
811:  [[7, 7, 5]]
853:  [[8, 6, 5]]
857:  [[9, 4, 4]]
863:  [[8, 7, 2]]
881:  [[9, 5, 3]]
919:  [[8, 7, 4]]
953:  [[9, 6, 2]]
1009:  [[9, 6, 4], [10, 2, 1]]
1051:  [[8, 8, 3]]
1091:  [[10, 4, 3]]
1217:  [[10, 6, 1]]
1249:  [[9, 8, 2]]
1367:  [[8, 8, 7]]
1459:  [[9, 9, 1], [11, 4, 4]]
1483:  [[11, 5, 3]]
1559:  [[10, 7, 6]]
1583:  [[9, 9, 5]]
1637:  [[10, 8, 5]]
1753:  [[9, 8, 8]]
1801:  [[9, 9, 7]]
1861:  [[12, 5, 2]]
1907:  [[11, 8, 4]]
2017:  [[11, 7, 7]]
2027:  [[10, 10, 3]]
2069:  [[12, 6, 5]]
2087:  [[11, 9, 3]]
2213:  [[13, 2, 2]]
2251:  [[13, 3, 3]]
2267:  [[12, 8, 3]]
2269:  [[13, 4, 2]]
2287:  [[12, 7, 6]]
2339:  [[11, 10, 2]]
2447:  [[13, 5, 5]]
2477:  [[13, 6, 4]]
2521:  [[12, 9, 4]]
2663:  [[11, 11, 1]]
2689:  [[11, 11, 3]]
2729:  [[10, 10, 9], [12, 10, 1]]
2753:  [[14, 2, 1]]
2789:  [[11, 9, 9]]
2843:  [[11, 10, 8]]
2927:  [[13, 9, 1]]
2953:  [[13, 9, 3]]
2969:  [[12, 9, 8]]
3067:  [[12, 11, 2]]
3221:  [[13, 8, 8]]
3257:  [[14, 8, 1]]
3331:  [[11, 10, 10]]
3391:  [[11, 11, 9], [15, 2, 2]]
3413:  [[13, 10, 6]]
3457:  [[12, 10, 9], [12, 12, 1]]
3527:  [[15, 5, 3]]
3529:  [[13, 11, 1]]
3571:  [[12, 11, 8]]
3581:  [[12, 12, 5]]
3709:  [[13, 10, 8]]
3719:  [[15, 7, 1]]
3989:  [[13, 12, 4]]
4139:  [[14, 11, 4]]
4229:  [[15, 9, 5], [16, 5, 2]]
4339:  [[16, 6, 3]]
4421:  [[13, 13, 3]]
4447:  [[15, 9, 7], [16, 7, 2]]
4519:  [[13, 13, 5]]
4591:  [[15, 10, 6]]
4597:  [[14, 12, 5]]
4733:  [[15, 11, 3], [16, 8, 5]]
4787:  [[12, 12, 11]]
4831:  [[15, 11, 5]]
4889:  [[16, 9, 4]]
4951:  [[16, 8, 7]]
4967:  [[17, 3, 3]]
5039:  [[17, 5, 1]]
5167:  [[15, 12, 4]]
5381:  [[17, 7, 5]]
5573:  [[15, 13, 1]]
5641:  [[17, 8, 6]]
5653:  [[13, 12, 12]]
5669:  [[17, 9, 3]]
5851:  [[16, 12, 3]]
5867:  [[18, 3, 2]]
5897:  [[18, 4, 1]]
5923:  [[18, 4, 3]]
5939:  [[16, 11, 8]]
6037:  [[15, 11, 11]]
6173:  [[18, 6, 5]]
6217:  [[14, 14, 9]]
6271:  [[17, 11, 3]]
6301:  [[15, 13, 9], [16, 13, 2]]
6427:  [[16, 11, 10]]
6469:  [[18, 8, 5]]
6553:  [[16, 12, 9]]
6569:  [[18, 9, 2]]
6833:  [[18, 10, 1]]
6841:  [[16, 14, 1]]
6857:  [[17, 12, 6]]
7109:  [[19, 5, 5]]
7229:  [[19, 7, 3]]
7561:  [[18, 10, 9], [18, 12, 1]]
7589:  [[19, 9, 1]]
7687:  [[16, 15, 6]]
7867:  [[19, 10, 2]]
7873:  [[17, 14, 6]]
7883:  [[19, 8, 8]]
8009:  [[20, 2, 1]]
8081:  [[15, 15, 11]]
8093:  [[18, 13, 4]]
8171:  [[16, 14, 11]]
8191:  [[19, 11, 1]]
8219:  [[16, 16, 3]]
8243:  [[20, 6, 3]]
8317:  [[16, 16, 5], [19, 9, 9]]
8369:  [[17, 12, 12]]
8513:  [[20, 8, 1]]
8539:  [[20, 8, 3]]
8737:  [[20, 9, 2]]
8803:  [[19, 12, 6]]
8863:  [[15, 14, 14]]
9001:  [[20, 10, 1]]
9029:  [[18, 13, 10]]
9181:  [[19, 13, 5]]
9199:  [[16, 15, 12]]
9241:  [[20, 9, 8]]
9277:  [[21, 2, 2]]
9343:  [[20, 10, 7]]
9413:  [[21, 5, 3]]
9511:  [[21, 5, 5]]
9521:  [[17, 16, 8], [19, 11, 11]]
9547:  [[20, 11, 6]]
9587:  [[19, 12, 10]]
9619:  [[17, 15, 11]]
9631:  [[21, 7, 3]]
9719:  [[18, 15, 8]]
9781:  [[21, 8, 2]]
9907:  [[18, 14, 11]]
9929:  [[18, 16, 1]]

#!/usr/bin/env sage

def find_cubes (p):
    cubes = []
    # Loop over a >= b >= c
    for a in range (1,p):
        a3 = a**3
        if a3 >= p:
            break
        for b in range (1,a+1):
            a3_b3 = a3 + b**3
            if a3_b3 >= p:
                break
            for c in range (1,b+1):
                a3_b3_c3 = a3_b3 + c**3
                if a3_b3_c3 == p:
                    cubes.append ([a,b,c])
                if a3_b3_c3 >= p:
                    break
    return cubes


for p in Primes():
    if p > 10000:
        break
    cubes = find_cubes (p)
    if cubes:
        print ("%d: " % p, cubes)
Related Question