%I #35 Nov 11 2024 20:30:23
%S 2,19,79,149,569,587,1237,2129,2153,2237,2459,2549,4129,4591,4657,
%T 4999,8369,8999,9587,9629,9857,10061,17401,17659,17737,18691,20149,
%U 20479,33161,33347,34631,35117,35447,39023,40427,40709,66403,68539,74707,75703,79063,79333,80071
%N Primes whose binary reversal is a square.
%C The sequence of corresponding squares begins: 1, 25, 121, 169, 625, 841, 1369, 2209, 2401, 3025, 3481, 2809, 4225, 7921, ...
%C For n>1 the second and third most significant bits of a(n) are "0" because all odd squares are equal to 1 mod 8. - _Andres Cicuttin_, May 12 2016
%H Chai Wah Wu, <a href="/A226019/b226019.txt">Table of n, a(n) for n = 1..6182</a>
%t Select[Table[Prime[j],{j,1,10000}],Element[Sqrt[FromDigits[Reverse[IntegerDigits[#,2]],2]],Integers]&] (* _Andres Cicuttin_, May 12 2016 *)
%o (Python)
%o import math
%o primes = []
%o def addPrime(k):
%o for p in primes:
%o if k%p==0: return
%o if p*p > k: break
%o primes.append(k)
%o r = 0
%o p = k
%o while k:
%o r = r*2 + (k&1)
%o k>>=1
%o s = int(math.sqrt(r))
%o if s*s == r: print(p, end=', ')
%o addPrime(2)
%o addPrime(3)
%o for i in range(5, 1000000000, 6):
%o addPrime(i)
%o addPrime(i+2)
%o (Python)
%o from sympy import isprime
%o A226019_list, i, j = [2], 0, 0
%o while j < 2**34:
%o p = int(format(j,'b')[::-1],2)
%o if j % 2 and isprime(p):
%o A226019_list.append(p)
%o j += 2*i+1
%o i += 1
%o A226019_list = sorted(A226019_list) # _Chai Wah Wu_, Dec 20 2015
%o (Python)
%o from sympy import integer_nthroot, primerange
%o def ok(p): return integer_nthroot(int(bin(p)[:1:-1], 2), 2)[1]
%o def aupto(lim): return [p for p in primerange(2, lim+1) if ok(p)]
%o print(aupto(80071)) # _Michael S. Branicky_, Feb 19 2021
%o (PARI) isok(k) = isprime(k) && issquare(fromdigits(Vecrev(binary(k)), 2)); \\ _Michel Marcus_, Feb 19 2021
%Y Cf. A007488, A074832.
%Y Subsequence of A204219. Cf. also A235027.
%K nonn,base
%O 1,1
%A _Alex Ratushnyak_, May 23 2013