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

 Think big (Posted on 2017-08-03)
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.)
 Think Big ... Think UBASIC (spoilers) | Comment 1 of 2

4   kill "thinkbig.txt"
5   open "thinkbig.txt" for output as #2
10   A=1:B=1:Fibno=2
20   repeat
30     C=A+B:A=B:B=C:inc Fibno
40     if C>=123456789 then
50           :S\$=cutspc(str(C))
60           :S\$=left(S\$,9)
70           :Good=1
80           :for I=2 to 9
90              :if mid(S\$,I,1)="0" then Good=0:endif
100              :if instr(S\$,mid(S\$,I,1))<I then Good=0:endif
110          :next
120          :if Good then print Fibno:print C:print #2,Fibno:print #2,C
130                   :print log(C)/log(10):print #2,log(C)/log(10)
200   until Good
210   close #2

finds

2749
14372689553387917661829645671564334144347634506448917723663290089702222530009397342095721197748390
70344257883244060673479747605309576764462944357291571179264772234830238645312145444084379786392156
15811243995731348337926711176676611972455445566884229491936071938959883067027027606030473362083861
00938317422813175407356709232675779685357629997245797294804250463809150187026942349354902182628605
42240773941938280115089402195327750019589304535581136952004688833877277721869486440689050169486344
8727599353830662539700881454734823358742184362414868465995609763288002569665002250249

574.1575380450235298191 (its commmon log)

indicating the 2749th Fibonacci number, which is 575 digits long.

And if you think that's big, how about the 3890th Fibonacci number, which is 813 digits long:

409671328521829953998960829959558534694236081484909632216086222062898963018519277315330561444542657
795831083247975479224986474035021212541226758090560644644721253449955600122513853279416791903931934
214717500107306545627205947050643261558434960913137029297623703510958774819791903131722635014465496
053066123375627697218917992060089404189056407831359901746286053112665972300613911057013268054164959
667147741956168625963613833267022499359008887999416451834875251914947572965883460941980744956871664
646978242113002325784989818467932628969864547703211467185524514593196300564500500882844065327644935
079180483836136025263493218417434090781081546004288209053026650288566743947656685866529729802666973
247896244518561345788696734991331097107279709800200859382386723047006333581262755325956771786359313
552398879067278690145

812.6124355702492650873

from the modified program that looks for pandigital 0 through 9 in the first ten positions.

4   kill "thinkbi2.txt"
5   open "thinkbi2.txt" for output as #2
10   A=1:B=1:Fibno=2
20   repeat
30     C=A+B:A=B:B=C:inc Fibno
40     if C>=1023456789 then
50           :S\$=cutspc(str(C))
60           :S\$=left(S\$,10)
70           :Good=1
80           :for I=2 to 10
100              :if instr(S\$,mid(S\$,I,1))<I then Good=0:endif
110          :next
120          :if Good then print Fibno:print C:print #2,Fibno:print #2,C
130                   :print log(C)/log(10):print #2,log(C)/log(10)
200   until Good
210   close #2

The sizes of these numbers preclude use of Visual Basic.

 Posted by Charlie on 2017-08-03 10:31:36

 Search: Search body:
Forums (0)