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

Home > Numbers
Factorials & factorions (Posted on 2015-10-19) Difficulty: 3 of 5
A factorion is a number that equals the sum of the factorials of its decimal digits, e.g. 145 is a factorion because 1! + 4! + 5! = 1 + 24 + 120 = 145.

There are exactly four (in base 10) such numbers;
1, 2, 145, and the last one is for you to find.

Bonus task: Determine all numbers such that the sum of factorials of their digits - expressed in any imaginable base- is exactly the same regardless of the base chosen.

No Solution Yet Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2
1
2
145
40585

DefDbl A-Z
Dim crlf$, fact(9)


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 fact(0) = 1
 For i = 1 To 9
   fact(i) = i * fact(i - 1)
 Next
 
 For n = 1 To 9999999
   ns$ = LTrim(Str(n))
   tot = 0
   For i = 1 To Len(ns)
     tot = tot + fact(Val(Mid(ns, i, 1)))
   Next
   If tot = n Then
     Text1.Text = Text1.Text & n & crlf
   End If
   DoEvents
 Next n


 Text1.Text = Text1.Text & crlf & " done"
  
End Sub


  Posted by Charlie on 2015-10-19 14:42:49
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 (18)
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