OFFSET
1,1
COMMENTS
All prime numbers are generated, if the last digit of a term is subtracted from the next term of the sequence.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = prime(n) + a(n-1) mod 10, where a(0) = 0.
EXAMPLE
For n = 7: a(6) = 21 with last digit 1 and prime(7) = 17. 17 + 1 = 18, so a(7) = 18.
MATHEMATICA
FoldList[#2 + Mod[#1, 10] &, 0, Prime@ Range@ 54] (* Michael De Vlieger, Sep 18 2017 *)
nxt[{n_, a_}]:={n+1, Prime[n+1]+Mod[a, 10]}; Rest[NestList[nxt, {0, 0}, 60][[All, 2]]] (* Harvey P. Dale, May 26 2019 *)
PROG
(PARI) {p=2; print1(p", "); forprime(n=3, 300, a=n+p%10; print1(a", "); p=a)}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Dimitris Valianatos, Sep 06 2017
EXTENSIONS
Removed vacuous a(0) in NAME. - R. J. Mathar, Jun 19 2021
STATUS
approved