OFFSET
1,2
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..100000
FORMULA
For n <= 3, a(n) = n, and for n >= 4, a(n) = 4 if 2n-1 is a prime (for all n in A006254[3..] = 4, 6, 7, 9, 10, 12, 15, ...), and for all other n (numbers n such that 2n-1 is composite), a(n) = running count from 5 onward.
PROG
(PARI)
up_to = 1000;
partialsums(f, up_to) = { my(v = vector(up_to), s=0); for(i=1, up_to, s += f(i); v[i] = s); (v); }
v_partsums = partialsums(x -> isprime(x+x-1), up_to);
A305901(n) = if(n<=3, n, if(isprime(n+n-1), 4, 3+n-v_partsums[n]));
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jun 14 2018
STATUS
approved