CoCalc Shared Filessupport / 2017-03-14-101118-sums-of-fourth-powers.sagews
Authors: Harald Schilly, ℏal Snyder, William A. Stein
Description: Examples for support purposes.

Question: I am looking for two integers, $a$ and $b$, such that $a^4+ b^4 = 11572060353961555386606814001$. Can anyone help me to solve this problem using SageMath .

n = 11572060353961555386606814001
factor(n)

101 * 44621 * 10147901 * 253031037087781
# n is a sum of two *squares*:
sum_of_k_squares(2, n)

(70463059530200, 81283562887001)
#but not a perfect square
N(sqrt(70463059530200))

8.39422775067486e6
for p, _ in factor(n):
print p, p%4

101 1 44621 1 10147901 1 253031037087781 1

Because each $p$ dividing $n$ exactly divides $n$ and is $1$ mod $4$, there are 16=$2^4$ ways to write $n$ as a sum of two squares. If you write $n$ as a sum of two fourth powers, that's just one of these: $(a^2)^2 + (b^2)^2 = n$

K.<i> = QuadraticField(-1)
v = [factor(K(p)) for p, _ in factor(n)]
v

[(-1) * (i - 10) * (i + 10), (-10*i + 211) * (10*i + 211), (-1099*i + 2990) * (1099*i + 2990), (-5563791*i + 14902190) * (5563791*i + 14902190)]
v[0][0][0]

i - 10
for c in cartesian_product_iterator([[0,1]]*4):
rep = prod(v[i][k][0] for i, k in enumerate(c))
print c, rep
if is_square(rep[0]):
print "FOUND ONE! ", rep

(0, 0, 0, 0) 81283562887001*i - 70463059530200 (0, 0, 0, 1) 15216760633199*i - 106491833253980 (0, 0, 1, 0) 16301319409199*i - 106331215263820 (0, 0, 1, 1) -57372053092999*i - 90997295992000 (0, 1, 0, 0) 74255239366801*i - 77834566746020 (0, 1, 0, 1) 5077165185799*i - 107453630686160 (0, 1, 1, 0) 6172053092999*i - 107396304008000 (0, 1, 1, 1) -65720906289199*i - 85163506447820 (1, 0, 0, 0) -65720906289199*i + 85163506447820 (1, 0, 0, 1) 6172053092999*i + 107396304008000 (1, 0, 1, 0) 5077165185799*i + 107453630686160 (1, 0, 1, 1) 74255239366801*i + 77834566746020 (1, 1, 0, 0) -57372053092999*i + 90997295992000 (1, 1, 0, 1) 16301319409199*i + 106331215263820 (1, 1, 1, 0) 15216760633199*i + 106491833253980 (1, 1, 1, 1) 81283562887001*i + 70463059530200
# e.g.,
5077165185799^2 + 107453630686160^2

11572060353961555386606814001

As you can see, we didn't find any with the rep as a sum of two squares with each a square itself. So there are no such $a,b$.

Same problem by brute force search...

%python
from math import sqrt
def sum_of_two_fourth_powers(m):
b = int(sqrt(sqrt(m)))
print(b)
for i in xrange(b):
s = sqrt(sqrt(m-i**4))
if int(s) == s:
return i, int(s)

# test the above function
%time sum_of_two_fourth_powers(848^4 + 798^4)

980 (798, 848) CPU time: 0.00 s, Wall time: 0.00 s
# now try it on yours... and get nothing.
%time sum_of_two_fourth_powers(11572060353961555386606814001)

10371765 CPU time: 23.28 s, Wall time: 23.68 s