Consider five positive integers A < B < C < D < E in arithmetic sequence, and find all possible solutions of:
A4 + B4 + C4 + D4 = E4 - 143
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
For a = 1 To 10000
For diff = 1 To 10000
d = a + 3 * diff
d4 = d * d * d * d
If d4 > 1E+15 Then Exit For
b = a + diff: c = b + diff
tot = a * a * a * a + b * b * b * b + c * c * c * c + d4
totPlus = tot + 143
rt = Int(Sqr(Sqr(totPlus)) + 0.5)
If rt * rt * rt * rt = totPlus Then
Text1.Text = Text1.Text & a & Str(diff) & crlf
Text1.Text = Text1.Text & " done"
Finds only A = 3 and the successive differences are 1:
3^4 + 4^4 + 5^4 + 6^4 = 7^4 - 143
The program negelected to check that E was part of the arithmetic sequence, but the only sequence found for A through D did indeed result in an E that was part of the sequence.
Posted by Charlie
on 2014-12-19 15:29:55