 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Sum of 4 squares (Posted on 2018-07-08) The number N is a sum of 4 different numbers, each being a square of one of the 4 smallest divisors of N (e.g. N=36 does not qualify since 1^2+2^2+3^2+4^2
sums up to 30, not 36.)

Provide a full list of similar numbers or show that none exist.

 See The Solution Submitted by Ady TZIDON No Rating Comments: ( Back to comment list | You must be logged in to post comments.) computer finding (no proof of completeness) | Comment 1 of 4
DefDbl A-Z
Dim crlf\$, dvr(4)

Form1.Visible = True
Text1.Text = ""
crlf = Chr(13) + Chr(10)

For n = 4 To 10000
dct = 0
sr = Sqr(n)
For i = 1 To n
q = n / i
If q = Int(q) Then
dct = dct + 1
dvr(dct) = i
If dct = 4 Then Exit For
End If
If dct = 1 And i > sr Then Exit For
DoEvents
Next
If dct < 4 And dct > 1 Then
If dvr(dct) < n Then
dct = dct + 1: dvr(dct) = n / dvr(dct - 2)
If dvr(dct) < n And dct < 4 Then
dct = dct + 1: dvr(dct) = n / dvr(dct - 4)
End If
End If
End If
DoEvents
If dct = 4 Then

If dvr(1) * dvr(1) + dvr(2) * dvr(2) + dvr(3) * dvr(3) + dvr(4) * dvr(4) = n Then
Text1.Text = Text1.Text & n & "      " & dvr(1) * dvr(1) & "  " & dvr(2) * dvr(2) & "  " & dvr(3) * dvr(3) & "  " & dvr(4) * dvr(4)
Text1.Text = Text1.Text & crlf
End If

End If

Next

Text1.Text = Text1.Text & crlf & tot & " done"

End Sub

finds only

130   =   1 + 4 + 25 + 100

 Posted by Charlie on 2018-07-08 15:55:49 Please log in:

 Search: Search body:
Forums (0)