cp's OEIS Frontend

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.

Showing 1-5 of 5 results.

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

Original entry on oeis.org

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
Offset: 1

Views

Author

Keywords

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=1,2,3,...: 1, 3, 5, 8, 11, 18, 30, 53, 93, 187, 329, 600, 1080, 1936, 3657, 6756, 12328, 23127, 43909, 83377, 156049, 295916, 570396, 1090772, 2077090, 3991187, 7717804, 14825247, 28507572, 54938369, 106350934, ..., partial sums of A095741 plus 1. - Robert G. Wilson v, Feb 23 2018, corrected by Jeppe Stig Nielsen, Jun 17 2023

Crossrefs

Intersection of A000040 and A006995.
First row of A095749.
A095741 gives the number of terms in range [2^(2n), 2^(2n+1)].
Cf. A095730 (primes whose Zeckendorf expansion is palindromic), A029971 (primes whose ternary (base-3) expansion is palindromic).
Cf. A117697 (written in base 2), A002385, A194097, A256081.

Programs

  • Magma
    [NthPrime(n): n in [1..5000] | (Intseq(NthPrime(n), 2) eq Reverse(Intseq(NthPrime(n), 2)))]; // Vincenzo Librandi, Feb 24 2018
    
  • 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 *)
  • PARI
    is(n)=isprime(n)&&Vecrev(n=binary(n))==n \\ M. F. Hasler, Feb 23 2018
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(n) and (b:=bin(n)[2:]) == b[::-1]
    print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Apr 20 2024

Formula

Sum_{n>=1} 1/a(n) = A194097. - Amiram Eldar, Mar 19 2021

Extensions

More terms from Patrick De Geest

A095759 Triangle T(row>=0, 0<= pos <=row) by rows: T(r,p) contains number of odd primes p in range [2^(r+1),2^(r+2)] for which A037888(p)=pos.

Original entry on oeis.org

1, 2, 0, 0, 2, 0, 2, 3, 0, 0, 0, 5, 2, 0, 0, 3, 4, 6, 0, 0, 0, 0, 15, 4, 4, 0, 0, 0, 3, 18, 15, 7, 0, 0, 0, 0, 0, 32, 20, 16, 7, 0, 0, 0, 0, 7, 33, 63, 24, 10, 0, 0, 0, 0, 0, 0, 63, 62, 88, 33, 9, 0, 0, 0, 0, 0, 12, 81, 135, 154, 56, 26, 0, 0, 0, 0, 0, 0, 0, 119, 150, 314, 197, 72, 20, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Examples

			a(0) = T(0,0) = 1 as there is one prime 3 (11 in binary) in range ]2^1,2^2[ whose binary expansion is palindromic. a(1) = T(1,0) = 2 as there are two primes, 5 and 7 (101 and 111 in binary) in range ]2^2,2^3[ whose binary expansions are palindromic. a(2) = T(1,1) = 0, as there are no other primes in that range. a(3) = T(2,0) = 0, as there are no palindromic primes in range ]2^3,2^4[, but a(4) = T(2,1) = 2 as in the same range there are two primes 11 and 13 (1011 and 1101 in binary), whose binary expansion needs a flip of just one bit to become palindrome.
		

Crossrefs

Row sums: A036378. Bisection of the leftmost diagonal: A095741. Next diagonals: A095753, A095754, A095755, A095756. Central diagonal (column): A095760. The rightmost nonzero terms from each row: A095757 (i.e. central diagonal and next-to-central diagonal interleaved). The penultimate nonzero terms from each row: A095758. Cf. also A095749, A048700-A048704, A095742.

A194097 Decimal expansion of the sum of the reciprocals of A016041 (primes that are binary palindromes).

Original entry on oeis.org

8, 1, 5, 7, 1, 0, 1, 9, 6, 2, 9, 0
Offset: 0

Views

Author

Kausthub Gudipati, Aug 15 2011

Keywords

Examples

			Partial sum is 0.81571010760865175... if primes up to 40 binary digits are included; partial sum is 0.8157101534554485... if summed to 42 binary digits. - _R. J. Mathar_, Aug 27 2011
Partial sum is 0.81571019628323164... for primes up to 66 bits. - _Martin Raab_, Jan 13 2012
		

Crossrefs

Extensions

a(6)-a(11) from Martin Raab, Jan 13 2012
Edited by Jon E. Schoenfield, Nov 27 2016

A095731 Number of such primes p (A095730) such that Fib(n+1) <= p < Fib(n+2) (where Fib = A000045) and p's Zeckendorf-expansion A014417(p) is palindromic.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 2, 0, 3, 3, 0, 4, 8, 0, 15, 4, 0, 20, 42, 0, 44, 35, 0, 67, 147, 0, 231, 147, 0, 209, 538, 0, 833, 450, 0, 819, 2064, 0, 1701
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Crossrefs

A117773 Number of palindromic primes in base 2 with exactly n binary digits.

Original entry on oeis.org

0, 1, 2, 0, 2, 0, 3, 0, 3, 0, 7, 0, 12, 0, 23, 0, 40, 0, 94, 0, 142, 0, 271, 0, 480, 0, 856, 0, 1721, 0, 3099, 0, 5572, 0, 10799, 0, 20782, 0, 39468, 0, 72672, 0, 139867, 0, 274480, 0, 520376, 0, 986318, 0, 1914097, 0, 3726617, 0, 7107443, 0, 13682325, 0, 26430797, 0, 51412565, 0, 99204128, 0, 190457946, 0
Offset: 1

Views

Author

Martin Renner, Apr 15 2006

Keywords

Comments

Every palindrome with an even number of digits is divisible by 11 (in base 2), i.e., by 3 in base 10, and therefore is composite (not prime). Hence there is only one palindromic prime with an even number of digits, namely 11_2 = 3_{10}.

Crossrefs

Programs

Extensions

a(23)-a(40) from Donovan Johnson, Dec 02 2009
a(41)-a(66) from Martin Raab, Oct 20 2015
Showing 1-5 of 5 results.