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-10 of 12 results. Next

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.

A095749 Square array A(row>=1, col>=1) by antidiagonals: A(r,c) contains the c:th prime p for which A037888(p)=(r-1).

Original entry on oeis.org

3, 5, 2, 7, 11, 43, 17, 13, 53, 151, 31, 19, 71, 179, 599, 73, 23, 79, 233, 683, 2111, 107, 29, 83, 241, 739, 2143, 8543, 127, 37, 101, 271, 797, 2503, 9103, 33023, 257, 41, 109, 311, 853, 2731, 9623, 33151, 131839, 313, 47, 113, 331, 937, 3011, 10427, 33599, 135647, 531071
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Examples

			a(1) = A(1,1) = 3 (11 in binary) as it is the first prime whose binary expansion is palindromic. a(2) = A(1,2) = 5 (101 in binary) as it is the second prime whose binexp is palindromic. a(3) = A(2,1) = 2 (10 in binary) as it is the first prime whose binexp needs a flip of just one bit to become palindrome. a(4) = A(1,3) = 7 (111 in binary) as it is the third prime whose binexp is palindromic. a(5) = A(2,2) = 11 (1011 in binary) as it is the second prime whose binexp needs a flip of just one bit to become palindrome.
		

Crossrefs

Row 1: A016041, 2: A095743, 3: A095744, 4: A095745, 5: A095746. Cf. also A095759. A095747-A095748. Permutation of primes (A000040).

A095742 Sum of A037888(p) for all primes p such that 2^n < p < 2^(n+1).

Original entry on oeis.org

0, 0, 2, 3, 9, 16, 35, 69, 148, 271, 628, 1167, 2629, 4830, 10597, 20083, 42928, 81579, 174223, 331314, 701382, 1340756, 2825575, 5422454, 11361615, 21873923, 45673361, 88161666, 183458213, 354899159, 736343490, 1427495050, 2954560104
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2004

Keywords

Comments

Ratio a(n)/A036378(n) gives the average asymmetricity ratio for n-bit primes: 0, 0, 1, 0.6, 1.285714, 1.230769, 1.521739, 1.604651, 1.973333, 1.978102, 2.462745, 2.515086, 3.014908, 2.996278, 3.49736, 3.517779, 3.993674, 4.000932, 4.50946, 4.502405, 4.997877, 4.998792, 5.500352, 5.500462, 5.998361, 5.999852, 6.499427, 6.500684, 7.000277, 7.000323, 7.499731, 7.499885, 7.999929, etc. I.e. 2- and 3-bit odd primes are all palindromes, 4-bit primes need on average just a one-bit flip to become palindromes, etc.
Ratio (a(n)/A036378(n))/f(n), where f(n) is (n-1)/4 if n is odd and (n-2)/4 if n is even (i.e. it gives the expected asymmetricity for all odd numbers in range [2^n,2^(n+1)]) converges as follows: 1, 1, 2, 1.2, 1.285714, 1.230769, 1.014493, 1.069767, 0.986667, 0.989051, 0.985098, 1.006034, 1.004969, 0.998759, 0.999246, 1.00508, 0.998418, 1.000233, 1.002102, 1.000535, 0.999575, 0.999758, 1.000064, 1.000084, 0.999727, 0.999975, 0.999912, 1.000105, 1.00004, 1.000046, 0.999964, 0.999985, 0.999991, ...

Examples

			a(1)=0, as only prime in range ]2,4] is 3, which has palindromic binary expansion 11, i.e. A037888(3)=0. a(2)=0, as in range ]4,8] there are two primes 5 (101 in binary) and 7 (111 in binary) so A037888(5) + A037888(7) = 0. a(3)=2, as in range ]8,16] there are two primes, 11 (1011 in binary) and 13 (1101 in binary), thus A037888(11) + A037888(13) = 1+1 = 2.
		

Crossrefs

Cf. A095298, A095732 (sums of similar asymmetricity measures for Zeckendorf-expansion), A095753.

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

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

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.

A064834 If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 25 2001

Keywords

Comments

Might be called the Palindromic Deviation (or PD(n)) of n, since it measures how far n is from being a palindrome. - W. W. Kokko, Mar 13 2013
a(A002113(n)) = 0; a(A029742(n)) > 0; A136522(n) = A000007(a(n)). - Reinhard Zumkeller, Sep 18 2013

Examples

			a(456) = | 4 - 6 | = 2, a(4567) = | 4 - 7 | + | 5 - 6 | = 4.
		

Crossrefs

Programs

  • Haskell
    a064834 n = sum $ take (length nds `div` 2) $
                      map abs $ zipWith (-) nds $ reverse nds
       where nds = a031298_row n
    -- Reinhard Zumkeller, Sep 18 2013
    
  • Maple
    f:=proc(n)
    local t1,t2,i;
    t1:=convert(n,base,10);
    t2:=nops(t1);
    add( abs(t1[i]-t1[t2+1-i]),i=1..floor(t2/2) );
    end;
    [seq(f(n),n=0..120)]; # N. J. A. Sloane, Mar 24 2013
  • Mathematica
    f[n_] := (k = IntegerDigits[n]; l = Length[k]; Sum[ Abs[ k[[i]] - k[[l - i + 1]]], {i, 1, Floor[l/2] } ] ); Table[ f[n], {n, 0, 100} ]
  • Python
    from sympy import floor, ceiling
    def A064834(n):
        x, y = str(n), 0
        lx2 = len(x)/2
        for a,b in zip(x[:floor(lx2)],x[:ceiling(lx2)-1:-1]):
            y += abs(int(a)-int(b))
        return y
    # Chai Wah Wu, Aug 09 2014

Extensions

More terms from Vladeta Jovovic, Matthew Conroy and Robert G. Wilson v, Oct 26 2001

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

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
Showing 1-10 of 12 results. Next