OFFSET
1,1
COMMENTS
REFERENCES
John Mason, Email message, Apr 07 2015
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
N:= 100:
S:= {$1..N}:
R:= NULL;
for n from 1 do
if isprime(n) then if S = {} then break else t:= min(S) fi else t:= 2*n fi;
R:= R, t;
S:= S minus {t}
od:
R;
PROG
(Python)
from sympy import primepi, isprime
def A256420(n):
r = int(primepi(n))
def iterfun(f, n=0):
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m
def f(x): return int(r+(m:=x>>1)-primepi(m))
return iterfun(f, r) if isprime(n) else n<<1 # Chai Wah Wu, Oct 15 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Apr 07 2015
STATUS
approved