Sylvester's Sequence

Author

Eric W. Weisstein
March 6, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/SylvestersSequence.nb.

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

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

Enumeration

e[0]:=2
e[n_]:=e[n]=e[n-1]^2-e[n-1]+1

e/@Range[10]

Digits

Floor[Log[10,#]]+1&/@(e/@Range[20])

Primes

p=Position[e/@Range[17],_?PrimeQ]//Flatten//Timing

p=Position[e/@Range[18],_?PrimeQ]//Flatten//Timing

e/@p

Recurrence

RSolve[{e[n]==e[n-1]^2-e[n-1]+1,e[0]==2},e[n],n]

RecurrenceTable[{a[k]==a[k-1]^2-a[k-1]+1,a[0]==2},a[k],{k,1,10}]

RecurrenceTable[{a[k]==a[k-1]^2-a[k-1]+1,a[0]==2},a[k],{k,10,10}][[1]]