This title space is too small! The topic is Hardy-Ramanujan numbers. #5

This problem's question: 48988659276962496 is first sum of paired cubes that can be done five different ways. What is the sum of the positive integers that comprise those five pairs (ten positive integers altogether)?

See A011541 .

This is not a pencil-and-paper problem. It does take a small number of seconds on a 4.5GHz computer to find the pairs, which are not in the link mentioned above.


The answer is 2544864.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Joseph Newton
Jun 16, 2019

Python code (by no means efficient, but only takes a second or two on my computer):

bound = 0.00000001
# error bound for checking if a number is a cube,
# since cube root may not be totally accurate

n = int(input("Enter number: "))

numbers = []
a = 1
while a < (n//2)**(1/3) + bound:
    # test if b=n-a^3 is a cube number
    b = (n - (a**3))**(1/3)
    k = b%1 # distance from nearest integer
    b = round(b)
    if k < bound or k > 1 - bound:
        # found a cube
        print(a,b)
        numbers.append(a)
        numbers.append(b)
    a += 1

print("Sum: " + str(sum(numbers)))

Limit on cubes to be checked: 365903

Pairs found: ( 38787 365757 107839 362753 205292 342952 221424 336588 231518 331954 ) \left( \begin{array}{cc} 38787 & 365757 \\ 107839 & 362753 \\ 205292 & 342952 \\ 221424 & 336588 \\ 231518 & 331954 \\ \end{array} \right)

Sum: 2544864

The check for a cube being an integer is exact as failures are returned as radicals.

The program runs in about 15 milliseconds.

The two $ (dollar sign) should be replaced by backslashes. This is necessary because of errors in Brilliant's code block handling.

1
2
3
4
5
6
7
8
9
s = 48988659276962496;
q = Timing[n = Ceiling[N[Power[s, (3)^-1]]];
   Print[n];
   c = Table[i^3, {i, n}];
   ParallelTable[j = Power[s - i^3, (3)^-1];
    If[j $[Element] Integers $[And] i <= j, {i, j}, Nothing], {i, n}]
   ];
Print[q];
Print[Plus @@ Flatten[q[[2]]]]

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...