OFFSET
1,1
COMMENTS
Contains A080790 and p*2^i for all primes p in A074832 union A080790 and i > 0. - Michael S. Branicky, Oct 29 2024
LINKS
James C. McMahon, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
6 = 110_2 is a term since reversed it is 011_2 = 3 which is prime.
7 = 111_2 is not a term since base 2 palindromic numbers are not included.
MATHEMATICA
Select[Range[142], PrimeQ[r=FromDigits[Reverse[IntegerDigits[#, 2]], 2]]&&r!=#&] (* James C. McMahon, Nov 18 2024 *)
PROG
(Python)
from sympy import isprime
def ok(n): return (b:=bin(n)[2:]) != (br:=b[::-1]) and isprime(int(br, 2))
print([k for k in range(1, 143) if ok(k)]) # Michael S. Branicky, Oct 28 2024
(Python) # alternate program constructing terms directly from primes
from sympy import primerange
def auptobits(maxbits):
alst = []
for p in primerange(3, 1<<maxbits):
b = bin(p)[2:]; br = b[::-1]; t = int(br, 2)
if br != b: alst.append(t)
alst.extend(t<<i for i in range(1, maxbits-len(br)+1))
return sorted(alst)
print(auptobits(8)) # Michael S. Branicky, Oct 29 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Simon R Blow, Oct 27 2024
STATUS
approved