login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A215030
a(n) = A215029(A000040(n)), where A000040(n) is the n-th prime.
3
2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 2, 1, 0, 1, 2
OFFSET
1,1
COMMENTS
For primes whose value is 0, see A214912; for value 1 see A031215; and for value 2 see A215031.
LINKS
StackExchange, A prime number pattern, Jul 29 2012.
PROG
(PARI)
A215029(n) = if(n<=2, n, my(mp=precprime(n-1), d=n); while(mp>0, if(d>0, d -= mp, d += mp); mp = precprime(mp-1)); (d));
A215030(n) = A215029(prime(n)); \\ Antti Karttunen, Nov 28 2018
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Aug 05 2012
STATUS
approved