

A016041


Primes that are palindromic in base 2 (but written here in base 10).


28



3, 5, 7, 17, 31, 73, 107, 127, 257, 313, 443, 1193, 1453, 1571, 1619, 1787, 1831, 1879, 4889, 5113, 5189, 5557, 5869, 5981, 6211, 6827, 7607, 7759, 7919, 8191, 17377, 18097, 18289, 19433, 19609, 19801, 21157, 22541, 22669, 22861, 23581, 24029
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

See A002385 for palindromic primes in base 10, and A256081 for primes whose binary expansion is "balanced" (see there) but not palindromic.  M. F. Hasler, Mar 14 2015
Number of terms less than 4^k, k=0,1,2,...: 2, 4, 6, 9, 12, 19, 31, 54, 94, 188, 330, 601, 1081, 1937, 3658, 6757, 12329, 23128, 43910, 83378, 156050, 295917, 570397, 1090773, 2077091, 3991188, 7717805, 14825248, 28507573, 54938370, 106350935, ..., partial sums of A095741 plus 2.  Robert G. Wilson v, Feb 23 2018


LINKS

Robert G. Wilson v, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Zak Seidov, terms 1001..3000 from Michael De Vlieger)
K. S. Brown, On General Palindromic Numbers
P. De Geest, World!Of Palindromic Primes


MATHEMATICA

lst = {}; Do[ If[ PrimeQ@n, t = IntegerDigits[n, 2]; If[ FromDigits@t == FromDigits@ Reverse@ t, AppendTo[lst, n]]], {n, 3, 50000, 2}]; lst (* syntax corrected by Robert G. Wilson v, Aug 10 2009 *)
pal2Q[n_] := Reverse[x = IntegerDigits[n, 2]] == x; Select[Prime[Range[2800]], pal2Q[#] &] (* Jayanta Basu, Jun 23 2013 *)
genPal[n_Integer, base_Integer: 10] := Block[{id = IntegerDigits[n, base], insert = Join[{{}}, {#  1} & /@ Range[base]]}, FromDigits[#, base] & /@ (Join[id, #, Reverse@id] & /@ insert)]; k = 0; lst = {}; While[k < 100, AppendTo[lst, Select[ genPal[k, 2], PrimeQ]]; lst = Flatten@ lst; k++]; lst (* Robert G. Wilson v, Feb 23 2018 *)


PROG

(PARI) is(n)=isprime(n)&&Vecrev(n=binary(n))==n \\ M. F. Hasler, Feb 23 2018
(MAGMA) [NthPrime(n): n in [1..5000]  (Intseq(NthPrime(n), 2) eq Reverse(Intseq(NthPrime(n), 2)))]; // Vincenzo Librandi, Feb 24 2018


CROSSREFS

Intersection of A000040 & A006995. First row of A095749. A095741 gives the number of terms in range [2^(2n), 2^(2n+1)]. Cf. A095730 for primes whose Zeckendorfexpansion is palindromic and A029971 for those whose ternary (base3) expansion is.
Cf. A117697 (written in base 2), A002385, A256081.
Sequence in context: A296422 A174394 A057476 * A140797 A245730 A038893
Adjacent sequences: A016038 A016039 A016040 * A016042 A016043 A016044


KEYWORD

nonn,easy,base


AUTHOR

Robert G. Wilson v


EXTENSIONS

More terms from Patrick De Geest


STATUS

approved



