A161387 Primes p such that (p-1)/2 is an (odd) binary palindrome.
3, 7, 11, 19, 31, 43, 67, 103, 127, 131, 199, 239, 307, 331, 379, 439, 463, 547, 683, 887, 911, 991, 1123, 1171, 1291, 1531, 1543, 1783, 1951, 2731, 2843, 3067, 3079, 3511, 3823, 4099, 5107, 5323, 5419, 5659, 5851, 6151, 6343, 6679, 6871, 6967, 7159, 8191
Offset: 1
Examples
67 in binary is 1000011. All binary digits but the rightmost 1 form a palindrome (100001), so therefore (67-1)/2 = 33 is a palindrome. Since 67 is a prime, it is in this sequence.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A161388.
Terms include A000668. - Robert G. Wilson v, Jun 09 2009
Programs
-
Magma
[ p: p in PrimesInInterval(3, 8200) | s eq Reverse(s) where s is Intseq((p-1) div 2, 2) ]; // Klaus Brockhaus, Jun 09 2009
-
Mathematica
Select[Prime@Range[2,1500],(id=IntegerDigits[(#-1)/2,2])==Reverse[id]&] (* Ray Chandler, Jun 09 2009 *) fQ[n_] := Block[{id = IntegerDigits[(n - 1)/2, 2]}, id == Reverse@id]; Select[ Prime@ Range[2, 1100], fQ@# &] (* Robert G. Wilson v, Jun 09 2009 *)
-
PARI
forprime(p=3,100000,t=binary((p-1)/2);if(t==vector(#t,x,t[ #t+1-x]),print1(p,","))) \\ Hagen von Eitzen, Jun 10 2009
Formula
a(n) = 2*A161388(n) + 1.