OFFSET
1,2
COMMENTS
MAPLE
A116533 := proc(n) option remember; if n <=2 then n; else if isprime(procname(n-1)) then 2*procname(n-1) ; else procname(n-1)-1 ; end if; end if; end proc:
MATHEMATICA
Differences@ Prepend[NestList[If[PrimeQ@ #, 2 #, # - 1] &, 2, 90], 1] (* Michael De Vlieger, Dec 06 2018 *)
PROG
(PARI) a116533(n) = if(n==1, 1, if(n==2, 2, if(ispseudoprime(a116533(n-1)), 2*a116533(n-1), a116533(n-1)-1)))
a(n) = a116533(n+1)-a116533(n) \\ Felix Fröhlich, Dec 06 2018
(PARI) lista(nn) = {va = vector(nn); va[1] = 1; va[2] = 2; for (n=3, nn, va[n] = if (isprime(va[n-1]), 2*va[n-1], va[n-1]-1); ); vector(nn-1, n, va[n+1] - va[n]); } \\ Michel Marcus, Dec 07 2018
CROSSREFS
KEYWORD
sign
AUTHOR
Vladimir Shevelev, Aug 07 2009, Aug 14 2009
STATUS
approved