The primes of Fibonacci sequence: behavior and visualization​
​by Daniel Carvalho
I was a little bored, and suddenly this idea to check how the primes in the Fibonacci sequence behave...
Lets check this out!
First check a definition about it with Wikipedia data
WikipediaData["Fibonacci prime"]//StringTake[#,205]&
Out[]=
A Fibonacci prime is a Fibonacci number that is prime, a type of integer sequence prime.The first Fibonacci primes are (sequence A005478 in the OEIS):​2, 3, 5, 13, 89, 233, 1597, 28657, 514229, 433494437
WordCloud[DeleteStopwords[WikipediaData["Fibonacci prime"]]]
Out[]=
WordCloud[DeleteStopwords[WikipediaData["Fibonacci"]]]
Out[]=
WordCloud[DeleteStopwords[WikipediaData["Prime number"]]]
Out[]=
​
First take a look at the 1,000 Fibonacci that are prime, highlighting them in red in a simple list...
well the Fibonacci numbers quicky grows as crazy...
try it yourself without the Take function at postfix to see all the values...
If[PrimeQ[#],Style[#,Red,Bold],#]&/@Table[Fibonacci[s],{s,0,1000}]//Take[#,100]&
Out[]=
{0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170,1836311903,2971215073,4807526976,7778742049,12586269025,20365011074,32951280099,53316291173,86267571272,139583862445,225851433717,365435296162,591286729879,956722026041,1548008755920,2504730781961,4052739537881,6557470319842,10610209857723,17167680177565,27777890035288,44945570212853,72723460248141,117669030460994,190392490709135,308061521170129,498454011879264,806515533049393,1304969544928657,2111485077978050,3416454622906707,5527939700884757,8944394323791464,14472334024676221,23416728348467685,37889062373143906,61305790721611591,99194853094755497,160500643816367088,259695496911122585,420196140727489673,679891637638612258,1100087778366101931,1779979416004714189,2880067194370816120,4660046610375530309,7540113804746346429,12200160415121876738,19740274219868223167,31940434634990099905,51680708854858323072,83621143489848422977,135301852344706746049,218922995834555169026}
Lets select just the Fibonacci primes and view it in a bar chart...
It is better to use log in order to view all the numbers graphically...
Select[Table[Fibonacci[s],{s,0,1000}],PrimeQ]​​BarChart[%,ColorFunctionHue,PlotLabel"Prime fibonacci"]​​BarChart[Log[%%],ColorFunctionHue,PlotLabel"Prime fibonacci (log)"]
Out[]=
{2,3,5,13,89,233,1597,28657,514229,433494437,2971215073,99194853094755497,1066340417491710595814572169,19134702400093278081449423917,475420437734698220747368027166749382927701417016557193662268716376935476241,529892711006095621792039556787784670197112759029534506620905162834769955134424689676262369,1387277127804783827114186103186246392258450358171783690079918032136025225954602593712568353,3061719992484545030554313848083717208111285432353738497131674799321571238149015933442805665949,10597999265301490732599643671505003412515860435409421932560009680142974347195483140293254396195769876129909,36684474316080978061473613646275630451100586901195229815270242868417768061193560857904335017879540515228143777781065869,96041200618922553823942883360924865026104917411877067816822264789029014378308478864192589084185254331637646183008074629}
Out[]=
Out[]=
Lets go deep and spy primes in the 10,000 first Fibonacci values
BarChart[​​Log[Select[Table[Fibonacci[s],{s,0,10000}],PrimeQ]]​​,ColorFunctionHue,PlotLabel"Prime fibonacci (log)"]
Out[]=
Lets check the distance between those prime Fibonacci numbers with a new function
In[]:=
distance[v_List]:=#〚2〛-#〚1〛&/@Partition[Riffle[Most[v],Rest[v]],2]
Testing the function, it sums consecutive values in the given list
Append[Range[10],20]​​distance[%]
To view something interesting we need to Log it, facing the values grows fast!
Lets save the primes in the 10k first Fibonacci numbers in a variable and in a file, because it takes time to be calculated...
We can save it on Wolfram Cloud too, it is more fashion! Local files are old school!!
We can use CloudGet to get the data back latter
Check how many primes we have at the first 10k Fibonacci numbers
View the last and biggest one
Uau! How many digits are there at this big Fibonacci prime integer??
Wha is the size of all the numbers in this list?
Lets see those 20 Fibonacci prime numbers as binary
Lets see the first 1k Fibonacci numbers as binary pattern
The same view padding left with 400 first numbers, we can notes gliders and randomness
I published a function called SeguenceGraph where we can view a graph of a series, lets try with this big number
We can see it for all the Fibonacci primes we have
OK, now we can check how those Fibonacci primes fits the Benford’s Law
Get the first digits
View the list
Now count the occurrence of the first digits values
I think we need more data to validate Benford’s Law here
Play around with numbers is fun!!
What did you do when you get bored??!!
I like to do some data science style tinkering with Wolfram Language!
​
Please add your suggestions about how to view the Fibonacci primes
References:
​
https://mathworld.wolfram.com/BenfordsLaw.html
https://mathworld.wolfram.com/FibonacciNumber.html
https://mathworld.wolfram.com/PrimeNumber.html
https://resources.wolframcloud.com/FunctionRepository/resources/SequenceGraph/
https://en.wikipedia.org/wiki/Fibonacci_prime
​