`x=1:200`

z=outer(x,x, function(x,y) x^4+y^4)

z=z[upper.tri(z, diag=TRUE)]

names(which(table(z)==2))

I had my program pre-caculate the fourth powers up to the maximum bound, but I didn’t do anything by hand.

]]>Also, no one knows whether there’s a number that’s the sum of two fifth powers in two ways.

]]>a^4 + b^4 = c^4 + d^4 = S

then, for any integer n,

(na)^4 + (nb)^4 = (nc)^4 + (nd)^4 = S·(n^4)

You could ask, of course, which is the biggest one which is not a scaling of a smaller one.

]]>7985644522300177

]]>

(defn frth

[x]

(reduce * (repeat 4 x)))

`(defn find-euler-sums`

[]

(let [sums (apply concat (map

(fn [a] (map

(fn [b] (+ (frth a) (frth b)))

(range a 159)))

(range 1 159)))]

(distinct (filter (fn [a] (> (count (filter (fn [b] (= b a)) sums)) 1)) sums))))

28^4 + 956^4 = 628^4 + 908^4 = 835 279 626 752

Anyone get their computer to find one over a trillion?

Oh, biggest isn’t the point?

]]>87539319 = 167^3 + 436^3, 228^3 + 423^3, 255^3 + 414^3

You have to love brute force 🙂

]]>635318657 = 59^4 + 158^4, 133^4 + 134^4

3262811042 = 7^4 + 239^4, 157^4 + 227^4

8657437697 = 193^4 + 292^4, 256^4 + 257^4

and so on….

]]>`C=:13 :'#~.0-.~,I."1 x=y'"0 2`

```
```

`e4=:3 :0`

n=: }.i.160x

P=: 4 ^~ n

p=:~.,P

A=: +/~p

N=: ~.,A

N#~ 2 < N C A

)

Here’s what it tells me:

` e4''`

635318657

In other words: considering all pairs of fourth powers of integers in the range 1..159, the only sum of pairs that uses more than two of the original integers is 635318657.

That said, note that the original problem assumes we are only considering positive integers. Also, note that 1729 is particularly simple, because 729 is 9^3 and 1728 is 12^3. Note also that once upon a time it memorizing the “times table” for value 1..12 was something everyone did after a few years of school, and memorizing the cubes of 1..12 would be a minor extension of that practice.

]]>

import collections

import math

upper_bound = math.ceil(math.sqrt(math.sqrt(653518657)))

cnt = collections.Counter(x**4+y**4 for x in range(1, upper_bound) for y in range(1, upper_bound) if x >= y)

[x for x in cnt if cnt[x] == 2]

If upper_bound is increased to 1000, the first few results are:

635318657, 3262811042, 8657437697, 10165098512, 51460811217, 52204976672, 68899596497, 86409838577, 138519003152, 160961094577, 162641576192, 264287694402, 397074160625, 701252453457, 823372979472, 835279626752