This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A352942 #112 Apr 23 2025 19:53:13 %S A352942 1,1,1,1,0,0,1,2,2,1,2,1,1,3,1,2,1,1,2,3,1,1,1,1,2,3,2,0,1,1,0,2,1,2, %T A352942 3,1,1,4,1,0,1,1,0,1,3,1,0,0,1,1,0,0,0,0,0,1,2,2,0,3,2,1,1,2,2,1,1,0, %U A352942 3,0,0,2,2,0,2,2,2,3,2,2,0,2,0,1,2,0,1 %N A352942 Let p = prime(n); a(n) = number of primes q with same number of binary digits as p that can be obtained from p by changing one binary digit. %C A352942 a(n) is also the degree of prime(n) in the graph P(A070939(prime(n)), 2), defined in A145667. %H A352942 Paolo Xausa, <a href="/A352942/b352942.txt">Table of n, a(n) for n = 1..10000</a> %F A352942 a(n) = deg(prime(n)) in P(A070939(prime(n)), 2) (see A145667). %e A352942 prime(1) = 2, in binary 10, has one neighbor 11 in P(2, 2), so a(1) = 1. %e A352942 prime(14) = 43, in binary 101011, has neighbors 101001 (41), 101111 (47), 111011 (59), so a(14) = 3. %p A352942 a:= n-> (p-> nops(select(isprime, {seq(Bits[Xor] %p A352942 (p, 2^i), i=0..ilog2(p)-1)})))(ithprime(n)): %p A352942 seq(a(n), n=1..100); # _Alois P. Heinz_, May 11 2022 %t A352942 A352942[n_] := Count[BitXor[#, 2^Range[0, BitLength[#] - 2]], _?PrimeQ] & [Prime[n]]; %t A352942 Array[A352942, 100] (* _Paolo Xausa_, Apr 23 2025 *) %o A352942 (Python) %o A352942 from sympy import isprime, sieve %o A352942 def neighs(s): %o A352942 digs = "01" %o A352942 ham1 = (s[:i]+d+s[i+1:] for i in range(len(s)) for d in digs if d!=s[i]) %o A352942 yield from (h for h in ham1 if h[0] != '0') %o A352942 def a(n): %o A352942 return sum(1 for s in neighs(bin(sieve[n])[2:]) if isprime(int(s, 2))) %o A352942 print([a(n) for n in range(1, 88)]) %Y A352942 Binary analog of A125002. %Y A352942 Cf. A000040, A004676, A070939, A104080, A014234, A137985, A145667, A353738. %K A352942 nonn,base %O A352942 1,8 %A A352942 _Michael S. Branicky_, May 11 2022