OFFSET
1,3
COMMENTS
0, 7 and numbers n such that n+1 is either prime or twice a prime. - Robert Israel, Aug 05 2015
MAPLE
sort([0, 7, op(select(t -> isprime(t+1), [$1..10^4])), op(select(t -> isprime((t+1)/2), [2*i+1$i=1..5*10^3]))]); # Robert Israel, Aug 05 2015
MATHEMATICA
r[n_] := Reduce[x >= y > 1 && n == x y + x + y, {x, y}, Integers];
Reap[For[n = 0, n <= 200, n++, If[r[n] === False, Sow[n]]]][[2, 1]] (* Jean-François Alcover, Feb 28 2019 *)
PROG
(Python)
from sympy import primepi
def A254636(n):
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return int(n-1+x-(x>=7)-primepi(x+1)-primepi(x+1>>1))
return bisection(f, n-1, n-1) # Chai Wah Wu, Oct 14 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Feb 03 2015
STATUS
approved