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-8 of 8 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.

A095743 Primes p for which A037888(p) = 1, i.e., primes whose binary expansion is almost symmetric, needing just a one-bit flip to become palindrome.

Original entry on oeis.org

2, 11, 13, 19, 23, 29, 37, 41, 47, 59, 61, 67, 89, 97, 103, 131, 137, 157, 167, 173, 181, 191, 193, 199, 211, 223, 227, 229, 239, 251, 277, 281, 317, 337, 349, 367, 373, 383, 401, 419, 431, 463, 467, 479, 487, 491, 503, 509, 521, 563, 569, 577
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Crossrefs

The second row of array A095749. Cf. A095753, A095748.

Programs

  • Maple
    f:= proc(n) local L,i;
      L:= convert(n,base,2);
      add(abs(L[i]-L[-i]),i=1..floor(nops(L)/2))
    end proc:
    select(t -> f(t) = 1, [seq(ithprime(i),i=1..1000)]); # Robert Israel, Dec 04 2023

A095748 Almost maximally asymmetric primes in binary.

Original entry on oeis.org

17, 31, 37, 41, 47, 59, 61, 67, 89, 97, 103, 139, 149, 163, 197, 263, 269, 283, 293, 307, 353, 359, 379, 389, 409, 433, 439, 449, 461, 499, 541, 557, 607, 613, 631, 659, 727, 743, 809, 829, 877, 929, 941, 953, 997, 1009, 1039, 1051, 1151, 1171
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Comments

Primes p for which A037888(p) = floor((A070939(p)-4)/2). Those numbers contain just two bits mirroring each other, beyond the first and last bits. (All the odd primes without leading zeros begin and end in 1 bits.)

Examples

			a(5)=(101111)2. In this case, from left to right, the third bit agrees with the fourth. The prime 53 = (110101)_2 is not a term since the symmetry is limited to the first and last bits.
		

Crossrefs

Programs

  • PARI
    A070939(p) = { return(floor(log(p)/log(2))+1) };
    A037888(p)={v=binary(p);s=0;j=#v;for(k=1,#v,s+=abs(v[k]- v[j]);j--);return(s/2);}; forprime(p=3,1171,if(A037888(p)==floor((A070939(p)-4)/2), print1(p,", ")))

Extensions

Edited by Washington Bomfim, Jan 13 2011

A095744 Primes p for which A037888(p) = 2, i.e., primes whose binary expansion needs flips of just two bits to become palindrome.

Original entry on oeis.org

43, 53, 71, 79, 83, 101, 109, 113, 139, 149, 163, 197, 263, 269, 283, 293, 307, 353, 359, 379, 389, 409, 433, 439, 449, 461, 499, 523, 547, 571, 593, 619, 643, 673, 691, 751, 773, 811, 821, 839, 857, 863, 881, 887, 907, 983, 1013, 1031, 1049, 1063
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Crossrefs

The third row of array A095749. Cf. A095754.

Programs

  • Maple
    f:= proc(n) local L,i;
      L:= convert(n,base,2);
      add(abs(L[i]-L[-i]),i=1..floor(nops(L)/2))
    end proc:
    select(t -> f(t)=2, [seq(ithprime(i),i=1..1000)]); # Robert Israel, Dec 04 2023

A095747 Maximally asymmetric odd primes in binary.

Original entry on oeis.org

3, 5, 7, 11, 13, 19, 23, 29, 43, 53, 71, 79, 83, 101, 109, 113, 151, 179, 233, 241, 271, 311, 331, 347, 397, 421, 457, 599, 683, 739, 797, 853, 937, 977, 1087, 1103, 1223, 1307, 1427, 1459, 1597, 1613, 1733, 2017, 2111, 2143, 2503, 2731, 3011
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Comments

Primes p for which A037888(p) = floor((A070939(p)-2)/2). Those numbers contain just the first and last bits mirroring each other. Hence all the odd primes without leading zeros begin and end in 1 bits, the unique totally asymmetric prime being (10)_2 = 2.

Examples

			a(10)=(110101)2 since the symmetry is limited to the first and last bits. The number 47=(101111)2 is not a term because from left to right, the third bit matches with the fourth.
		

Crossrefs

Programs

  • PARI
    A070939(p)={return(floor(log(p)/log(2))+1)};
    A037888(p)={v=binary(p);s=0;j=#v;for(k=1,#v,s+=abs(v[k]-v[j]);j--);return(s/2);}; forprime(p=3,3011, if(A037888(p) ==floor((A070939(p)-2)/2),print1(p,", ")))

Extensions

Edited by Washington Bomfim, Jan 13 2011

A095745 Primes p for which A037888(p) = 3, i.e., primes whose binary expansion needs flips of just three bits to become palindrome.

Original entry on oeis.org

151, 179, 233, 241, 271, 311, 331, 347, 397, 421, 457, 541, 557, 607, 613, 631, 659, 727, 743, 809, 829, 877, 929, 941, 953, 997, 1009, 1039, 1051, 1151, 1171, 1231, 1291, 1483, 1511, 1523, 1549, 1567, 1609, 1637, 1669, 1693, 1741, 1801
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Crossrefs

The fourth row of array A095749. Cf. A095755.

A095746 Primes p for which A037888(p)=4, i.e., primes whose binary expansion needs flips of just four bits to become palindrome.

Original entry on oeis.org

599, 683, 739, 797, 853, 937, 977, 1087, 1103, 1223, 1307, 1427, 1459, 1597, 1613, 1733, 2017, 2141, 2221, 2239, 2251, 2287, 2357, 2389, 2399, 2423, 2467, 2617, 2683, 2699, 2729, 2767, 2851, 2897, 2903, 3019, 3167, 3389, 3461, 3527, 3533
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Crossrefs

The fifth row of array A095749. Cf. A095756.
Showing 1-8 of 8 results.