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

Home > Numbers
Summing the factorials (Posted on 2014-03-15) Difficulty: 3 of 5
1.Please list all the squares, below 6000, that are the sum of three distinct factorials.
2.Same task, without the "distinct" condition.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
Since 8! is greater than 6,000, we only need to check sums that involve factorials of digits up to 7.  The following checks for part 1:

squares = []
for a in range(6):
for b in range(a+1,7):
for c in range(b+1,8):
f = factorial(a) + factorial(b) + factorial(c)
if sqrt(f) == floor(sqrt(f)) and f not in squares:
squares.append(f)
print a, b, c, f

and produces:

0 1 2 4
0 2 3 9
0 5 6 841
4 5 7 5184

For part 2, a simple tweak to the code checks without the distinct condition and produces two more results:

0 0 2 4
0 2 3 9 
0 4 4 49
0 5 6 841
3 3 4 36
4 5 7 5184

  Posted by tomarken on 2014-03-15 11:02:55
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (24)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information