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

Home > Numbers
Think big (Posted on 2017-08-03) Difficulty: 4 of 5
What is the smallest Fibonacci number that is 1-9 pandigital in its first nine digits?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Actually it could be done with VB Comment 2 of 2 |
(In reply to Think Big ... Think UBASIC (spoilers) by Charlie)

The program below first verifies the logarithmic formula used works for finding Fibonacci numbers, then finds the answer:

The verification of formula validity:

1   1
2   1
3   2
4   3
5   5
6   8
7   13
8   21
9   34
10   55

The answer:
2749   574.157538045026

That is, the 2749th Fibonacci number which is approximately 10^574.157538045026 or  1.437268955346967 x 10^574 is the first such number asked for.

A similar program would work for the unasked-for 10-digit pandigital.


DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 phi = (1 + Sqr(5)) / 2
 lphi = Log(phi) / Log(10)
 l5 = Log(5) / Log(10)
 lFib = lphi - l5 / 2
 For i = 1 To 10
   Text1.Text = Text1.Text & i & "   " & Int(10 ^ lFib + 0.5) & crlf
   lFib = lFib + lphi
 Next
 
 
 
lFib = lphi - l5 / 2: Fibno = 1

Do
  Fibno = Fibno + 1
  lFib = lFib + lphi
  mantissa = lFib - Int(lFib)
  alog = 10 ^ mantissa
  s$ = LTrim(Str(alog))
  ix = InStr(s, ".")
  If ix > 0 Then s = Left(s, ix - 1) + Mid(s, ix + 1)
  good = 1
  For i = 2 To 9
   If Mid(s, i, 1) = "0" Then good = 0: Exit For
   If InStr(s, Mid(s, i, 1)) < i Then good = 0: Exit For
  Next
  If good Then Text1.Text = Text1.Text & Fibno & "   " & lFib & crlf: Exit Do
Loop
 
 
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub



  Posted by Charlie on 2017-08-03 11:08:15
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 (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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