All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Some sums (Posted on 2015-04-07)
Consider the two equalities:
1!+5! = 11^2
4!+5! = 12^2

Is there a pair of successive integers (below 1000) such that their squares can be written as a sum of 2 factorials?

 See The Solution Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 2 of 3 |
18! is a 16-digit number, so checking the sums of pairs of factorials up to that of 18 for whether the sum is a square will be sufficient. Only five cases of sums of two factorials result in perfect squares:

`a b   sqrt  a!+b!1 4      5    251 5     11   1211 7     71  50412 2      2     44 5     12   144`

In the sqrt column (that is, the square root of the sum of factorials), only two of the numbers are successive: the 11 and 12 of the original set from the puzzle.

For a = 1 To 18
For b = a To 18
tot = fact(a) + fact(b)
sr = Int(Sqr(tot) + 0.5)
If sr * sr = tot Then
Text1.Text = Text1.Text & a & Str(b) & "     " & sr & Str(sr * sr) & crlf
DoEvents
End If
Next
Next

Function fact(x)
f = 1
For i = 2 To x
f = f * i
Next
fact = f
End Function

Of course, upon reading Dej Mar's answer, I realize I neglected the negative square roots.

 Posted by Charlie on 2015-04-07 14:34:22

 Search: Search body:
Forums (0)