Primefree Sequence

Author

Eric W. Weisstein
February 8, 2006

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/PrimefreeSequence.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PrimefreeSequence.html.

©2006 Wolfram Research, Inc. except for portions noted otherwise

Graham

Remove[a]
a[1]:=331635635998274737472200656430763
a[2]:=1510028911088401971189590305498785
a[n_]:=a[n]=a[n-2]+a[n-1]

Length[IntegerDigits[#]]&/@{a[1],a[2]}

Array[a,10]

Flatten[Position[Array[a,10^5],_?PrimeQ]]//Timing

Knuth

Remove[a]
a[1]:=62638280004239857
a[2]:=49463435743205655
a[n_]:=a[n]=a[n-2]+a[n-1]

Length[IntegerDigits[#]]&/@{a[1],a[2]}

Array[a,10]

Flatten[Position[Array[a,10^5],_?PrimeQ]]//Timing

Wilf

Remove[a]
a[1]:=20615674205555510
a[2]:=3794765361567513
a[n_]:=a[n]=a[n-2]+a[n-1]

Length[IntegerDigits[#]]&/@{a[1],a[2]}

Array[a,10]

Flatten[Position[Array[a,10^5],_?PrimeQ]]//Timing

Hoffman's Inverted Version

FullSimplify[RSolve[{a[n]==a[n-2]+a[n-1],a[1]==3794765361567513
a[2]==20615674205555510},a[n],n],n∈Integers&&n>0]

Remove[a]
a[1]:=3794765361567513
a[2]:=20615674205555510
a[n_]:=a[n]=a[n-2]+a[n-1]

Length[IntegerDigits[#]]&/@{a[1],a[2]}

Array[a,10]

Flatten[Position[Table[a[n],{n,10^4}],_?PrimeQ]]//Timing

Flatten[Position[Table[a[n],{n,2 10^4}],_?PrimeQ]]//Timing

Terms

l={138,163,190,523,1855,3228,3579,6468,7170,10230,12783,17259,60139,91315,97923,101823,156075,182220};

Largest Term

Block[{$RecursionLimit=10^3},Do[a[n],{n,1,Last[l],10^2}]];//Timing

Digits[a[Last[l]]]

Primality Check

Do[
Print[{i,l[[i]],PrimeQ[a[l[[i]]]]//Timing}],
{i,Length[l]}]

Nicol

Remove[a]
a[1]:=407389224418
a[2]:=76343678551
a[n_]:=a[n]=a[n-2]+a[n-1]

Length[IntegerDigits[#]]&/@{a[1],a[2]}

Array[a,10]

Flatten[Position[Array[a,10^5],_?PrimeQ]]//Timing