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

Home > Numbers
Find a Frenzy Fibo (Posted on 2014-08-06) Difficulty: 2 of 5
Find the smallest Fibonacci number with a prime subscript but not prime itself.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts For a similar problem Comment 2 of 2 |
The smallest Fibonacci number with a prime subscript but itself composite:

The first 30 Fibo numbers and their smallest prime divisors:

  1       1      1
  2       1      1
  3       2      2
  4       3      3
  5       5      5
  6       8      2
  7      13     13
  8      21      3
  9      34      2
 10      55      5
 11      89     89
 12     144      2
 13     233    233
 14     377     13
 15     610      2
 16     987      3
 17    1597   1597
 18    2584      2
 19    4181     37
 19  4181
 20    6765      3
 21   10946      2
 22   17711     89
 23   28657  28657
 24   46368      2
 25   75025      5
 26  121393    233
 27  196418      2
 28  317811      3
 29  514229 514229
 30  832040      2

F(19) = 4181 = 37 * 113 is the solution to this similar puzzle.

DefDbl A-Z
Dim wd(10) As String, w As String, sz, crlf$
Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function

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

 fibn = 0: fibnp1 = 1
 For n = 1 To 30
   h = fibn + fibnp1
   fibn = fibnp1: fibnp1 = h
   Text1.Text = Text1.Text & mform(n, "###") & mform(fibn, "########") & mform(prmdiv(fibn), "#######") & crlf
   If prmdiv(n) = n And prmdiv(fibn) < fibn Then
     Text1.Text = Text1.Text & mform(n, "###") & mform(fibn, "######") & crlf
   End If
 Next


End Sub


Function prmdiv(num)
 Dim n, dv, q
 If num = 1 Then prmdiv = 1: Exit Function
 n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0
 If limit <> Int(limit) Then limit = Int(limit + 1)
 dv = 2: GoSub DivideIt
 dv = 3: GoSub DivideIt
 dv = 5: GoSub DivideIt
 dv = 7
 Do Until dv > limit
   GoSub DivideIt: dv = dv + 4 '11
   GoSub DivideIt: dv = dv + 2 '13
   GoSub DivideIt: dv = dv + 4 '17
   GoSub DivideIt: dv = dv + 2 '19
   GoSub DivideIt: dv = dv + 4 '23
   GoSub DivideIt: dv = dv + 6 '29
   GoSub DivideIt: dv = dv + 2 '31
   GoSub DivideIt: dv = dv + 6 '37
 Loop
 If n > 1 Then prmdiv = n
 Exit Function

DivideIt:
 Do
  q = Int(n / dv)
  If q * dv = n And n > 0 Then
    prmdiv = dv: Exit Function
   Else
    Exit Do
  End If
 Loop

 Return
End Function


  Posted by Charlie on 2014-08-06 11:22:46
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
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