|
|
A163961
|
|
First differences of A116533.
|
|
13
|
|
|
1, 2, -1, 3, -1, 5, -1, -1, -1, 7, -1, 13, -1, -1, -1, 23, -1, -1, -1, 43, -1, -1, -1, 83, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, -1, 317, -1, -1, -1, 631, -1, -1, -1, 1259, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2503, -1, -1, -1, 5003, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Ignoring the +-1 terms, we obtain the sequence of Bertrand's primes A006992. If we consider sequences A_i={a_i(n)}, i=1,2,... with the same constructions as A116533, but with initials a_1(1)=2, a_2(1)=11, a_3(1)=17,..., a_m(1)=A164368(m),..., then the union of A_1,A_2,... contains all primes.
|
|
LINKS
|
|
|
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)))
(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
|
|
|
STATUS
|
approved
|
|
|
|