OFFSET
1,8
COMMENTS
EXAMPLE
prime(1) = 2, in binary 10, has one neighbor 11 in P(2, 2), so a(1) = 1.
prime(14) = 43, in binary 101011, has neighbors 101001 (41), 101111 (47), 111011 (59), so a(14) = 3.
MAPLE
a:= n-> (p-> nops(select(isprime, {seq(Bits[Xor]
(p, 2^i), i=0..ilog2(p)-1)})))(ithprime(n)):
seq(a(n), n=1..100); # Alois P. Heinz, May 11 2022
PROG
(Python)
from sympy import isprime, sieve
def neighs(s):
digs = "01"
ham1 = (s[:i]+d+s[i+1:] for i in range(len(s)) for d in digs if d!=s[i])
yield from (h for h in ham1 if h[0] != '0')
def a(n):
return sum(1 for s in neighs(bin(sieve[n])[2:]) if isprime(int(s, 2)))
print([a(n) for n in range(1, 88)])
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michael S. Branicky, May 11 2022
STATUS
approved