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.

Previous Showing 11-20 of 34 results. Next

A265326 n-th prime minus its binary reversal.

Original entry on oeis.org

1, 0, 0, 0, -2, 2, 0, -6, -6, 6, 0, -4, 4, -10, -14, 10, 4, 14, -30, -42, 0, -42, -18, 12, 30, 18, -12, 0, 18, 42, 0, -62, -8, -70, -20, -82, -28, -34, -62, -8, -26, 8, -62, 62, 34, -28, 8, -28, 28, 62, 82, -8, 98, 28, 0, -186, -84, -210, -60
Offset: 1

Views

Author

Max Barrentine, Dec 07 2015

Keywords

Comments

a(n) = 0 iff A000040(n) is in A016041. - Altug Alkan, Dec 07 2015
The graph consists of a succession of parallelograms. The parallelograms end when there is a long run of mostly positive terms followed by a long run of mostly negative terms. The places where the successive parallelograms end are the primes just before a power of 2: 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, ..., which are terms with indices 2, 4, 6, 11, 18, 31, 54, 97, 172, 309, 564, 1028, 1900, 3512, 6542, 12251, 23000, 43390, 82025, ... (see A014234 and A007053). - N. J. A. Sloane, May 29 2016

Examples

			n=5: prime(5) = 11_10 = 1011_2, reversing gives 1101_2 = 13_10, so a(5) = 11-13 = -2.
		

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L, j;
      L:= convert(n,base,2);
      add(L[-j]*2^(j-1),j=1..nops(L))
    end proc:
    map(t -> t - revdigs(t),  select(isprime, [2,seq(i,i=3..1000,2)])); # Robert Israel, Dec 08 2015
  • Mathematica
    Table[# - FromDigits[Reverse@ IntegerDigits[#, 2], 2] &@ Prime@ n, {n, 60}] (* Michael De Vlieger, Dec 09 2015 *)
  • PARI
    a098957(n) = my(v=binary(prime(n)), s); forstep(i=#v, 1, -1, s+=s+v[i]); s
    a(n) = prime(n) - a098957(n); \\ Altug Alkan, Dec 07 2015

Formula

a(n) = A000040(n) - A098957(n).
a(n) = A055945(A000040(n)). - Michel Marcus, Dec 08 2015

A046485 Sum of first n palindromic primes A002385.

Original entry on oeis.org

2, 5, 10, 17, 28, 129, 260, 411, 592, 783, 1096, 1449, 1822, 2205, 2932, 3689, 4476, 5273, 6192, 7121, 17422, 27923, 38524, 49835, 61246, 73667, 86388, 99209, 112540, 126371, 140302, 154643, 169384, 184835, 200386, 216447, 232808, 249369, 266030, 283501
Offset: 1

Views

Author

Patrick De Geest, Sep 15 1998

Keywords

Comments

The subsequence of prime partial sum of palindromic primes begins: 2, 5, 17, 5273, 7121, 154643, 283501. What is the smallest nontrivial (i.e., multidigit) palindromic prime partial sum of palindromic primes? [Jonathan Vos Post, Feb 07 2010]

Crossrefs

Programs

  • Mathematica
    t = {}; b = 10; Do[p = Prime[n]; i = IntegerDigits[p, b]; If[i == Reverse[i], AppendTo[t, p];(*Print[p.FromDigits[i]]*)], {n, 4000}]; Accumulate[t] (* Vladimir Joseph Stephan Orlovsky, Feb 23 2012 *)
    Accumulate[Select[Prime[Range[10000]],IntegerDigits[#]==Reverse[ IntegerDigits[#]]&]] (* Harvey P. Dale, Aug 10 2013 *)

Formula

a(n) = Sum_{i=1..n} A002385(i) = Sum_{i=1..n} {p prime and R(p) = p, i.e., primes whose decimal expansion is a palindrome}. [Jonathan Vos Post, Feb 07 2010]

Extensions

Offset set to 1 by R. J. Mathar, Feb 21 2010

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

A164126 First differences of A006995.

Original entry on oeis.org

1, 2, 2, 2, 2, 6, 2, 4, 6, 4, 2, 12, 6, 12, 2, 8, 12, 8, 6, 8, 12, 8, 2, 24, 12, 24, 6, 24, 12, 24, 2, 16, 24, 16, 12, 16, 24, 16, 6, 16, 24, 16, 12, 16, 24, 16, 2, 48, 24, 48, 12, 48, 24, 48, 6, 48, 24, 48, 12, 48, 24, 48, 2, 32, 48, 32, 24, 32, 48, 32, 12, 32, 48, 32, 24, 32, 48, 32, 6
Offset: 1

Views

Author

Keywords

Comments

Contribution from Hieronymus Fischer, Feb 18 2012: (Start)
From the formula section it follows that a(2^m - 1 + 2^(m-1) - k) = a(2^m - 1 + k) for 0 <= k <= 2^(m-1), as well as a(2^m - 1 + 2^(m-1) - k) = 2 for k=0, 2^(m-1) and a(2^m - 1 + 2^(m-1) - k) = 6 for k=2^(m-2), hence, starting from positions n=2^m-1, the following 2^(m-1) terms form symmetric tuples limited on the left and on the right by a '2' and always having a '6' as the center element.
Example: for n = 15 = 2^4 - 1, we have the (2^3+1)-tuple (2,8,12,8,6,8,12,8,2).
Further on, since a(2^m - 1 + 2^(m-1) + k) = a(2^(m+1) - 1 - k) for 0 <= k <= 2^(m-1) an analogous statement holds true for starting positions n = 2^m + 2^(m-1) - 1.
Example: for n = 23 = 2^4 + 2^3 - 1, we find the (2^3+1)-tuple (2,24,12,24,6,24,12,24,2).
If we group the sequence terms according to the value of m=floor(log_2(n)), writing those terms together in separate lines and opening each new line for n >= 2^m + 2^(m-1), then a kind of a 'logarithmic shaped' cone end will be formed, where both the symmetry and the calculation rules become obvious. The first 63 terms are depicted below:
1
2
2
2 2
6 2
4 6 4 2
12 6 12 2
8 12 8 6 8 12 8 2
24 12 24 6 24 12 24 2
16 24 16 12 16 24 16 6 16 24 16 12 16 24 16 2
48 24 48 12 48 24 48 6 48 24 48 12 48 24 48 2
.
(End)
Decremented by 1, also the sequence of run lengths of 0's in A178225. - Hieronymus Fischer, Feb 19 2012

Examples

			a(1) = A006995(2) - A006995(1) = 1 - 0 = 1.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=FromDigits[RealDigits[n,2][[1]]]==FromDigits[Reverse[RealDigits[n, 2][[1]]]]; a=1;lst={};Do[If[f[n],AppendTo[lst,n-a];a=n],{n,1,8!,1}]; lst
  • Python
    def A164126(n):
        if n == 1: return 1
        m = (a:=1<<(l:=n.bit_length()-2))|(n&a-1)
        k = (m<Chai Wah Wu, Jun 11 2024

Formula

a(n) = A006995(n+1) - A006995(n).
Contribution from Hieronymus Fischer, Feb 17 2012: (Start)
a(4*2^m - 1) = a(6*2^m - 1) = 2;
a(5*2^m - 1) = a(7*2^m - 1) = 6 (for m > 0);
Let m = floor(log_2(n)), then
Case 1: a(n) = 2, if n+1 = 2^(m+1) or n+1 = 3*2^(m-1);
Case 2: a(n) = 2^(m-1), if n = 0(mod 2) and n < 3*2^(m-1);
Case 3: a(n) = 3*2^(m-1), if n = 0(mod 2) and n >= 3*2^(m-1);
Case 4: a(n) = 3*2^(m-1)/gcd(n+1-2^m, 2^m), otherwise.
Cases 2-4 above can be combined as
Case 2': a(n) = (2 - (-1)^(n-(n-1)*floor(2*n/(3*2^m))))*2^(m-1)/gcd(n+1-2^m, 2^m).
Recursion formula:
Let m = floor(log_2(n)); then
Case 1: a(n) = 2*a(n-2^(m-1)), if 2^m <= n < 2^m + 2^(m-2) - 1;
Case 2: a(n) = 6, if n = 2^m + 2^(m-2) - 1;
Case 3: a(n) = a(n-2^(m-2)), if 2^m + 2^(m-2) <= n < 2^m + 2^(m-1) - 1;
Case 4: a(n) = 2, if n = 2^m + 2^(m-1) - 1;
Case 5: a(n) = (2 + (-1)^n)*a(n-2^(m-1)), otherwise (which means 2^m + 2^(m-1) <= n < 2^(m+1)).
(End)

Extensions

a(1) changed to 1 and keyword:base added by R. J. Mathar, Aug 26 2009

A262630 Base-10 representation of 1 and the primes at A262629.

Original entry on oeis.org

1, 7, 31, 127, 5113, 303049, 130677919, 8561616127, 343370835961, 398015959727917, 6536129506258687661, 136824982467292060343, 1727891550586579544797, 518772379027828374941147, 33164398702973727192477403, 91254204345537698333055497929
Offset: 1

Views

Author

Clark Kimberling, Oct 02 2015

Keywords

Examples

			n   A262629(n)    base-10 representation
1   1                 1
2   111               7
3   11111             31
4   1111111           127
5   1001111111001     5113
		

Crossrefs

Cf. A262629. Subsequence of A016041 (except a(1)).

Programs

  • Mathematica
    s = {1}; base = 2; z = 20; Do[NestWhile[# + 1 &, 1, ! PrimeQ[tmp = FromDigits[Join[#, IntegerDigits[Last[s]], Reverse[#]] &[IntegerDigits[#, base]], base]] &];
    AppendTo[s, FromDigits[IntegerDigits[tmp, base]]], {z}]; s  (* A262629 *)
    Map[FromDigits[ToString[#], base] &, s]  (* A262630 *)
    (* Peter J. C. Moses, Sep 01 2015 *)

A333421 Primes that are palindromic in factorial base.

Original entry on oeis.org

3, 7, 11, 41, 127, 139, 173, 179, 191, 751, 811, 5113, 5167, 5419, 5443, 6581, 6659, 6737, 6761, 6833, 6863, 6911, 6959, 40609, 40897, 41047, 41479, 42061, 42349, 42499, 42643, 42787, 50549, 51131, 51419, 51563, 52289, 52433, 52583, 52727, 363361, 363481, 365473
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2020

Keywords

Examples

			3 is a term since it is a prime number and its factorial base representation is 11 which is a palindrome.
		

Crossrefs

Programs

  • Mathematica
    max = 9; Select[Range[0, max! - 1], PrimeQ[#] && PalindromeQ @ IntegerDigits[#, MixedRadix[Range[max, 2, -1]]] &]

A056130 Palindromic primes in bases 2 and 4.

Original entry on oeis.org

3, 5, 17, 257, 5189, 65537, 83269, 86293, 1053953, 1066049, 1134929, 1311749, 1380629, 16864513, 17060929, 17909009, 18153809, 18171217, 21251141, 22103317, 289423441, 290455889, 290735441, 336662789, 336925957, 340873541
Offset: 1

Views

Author

Robert G. Wilson v, Jul 29 2000

Keywords

Comments

Intersection of A016041 and A029972.
Subsequence of primes of A097856. - Michel Marcus, Nov 07 2015

Examples

			5 is 101 (base 2) and 11 (base 4), that are both palindromic.
		

Crossrefs

Cf. A016041 and A029972.

Programs

  • Mathematica
    Do[If[PrimeQ[n], t = RealDigits[n, 4][[1]]; If[FromDigits[t] == FromDigits[Reverse[t]], s = RealDigits[n, 2][[1]]; If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]]], {n, 1, 10^8, 2}]

A164125 First differences of A029971.

Original entry on oeis.org

11, 10, 128, 22, 60, 524, 180, 156, 156, 180, 58, 180, 66, 90, 90, 66, 90, 6320, 714, 1008, 2190, 2650, 1722, 198, 1722, 41510, 810, 594, 1620, 6570, 3546, 5736, 1620, 1404, 810, 594, 1620, 522, 4428, 810, 1332, 1620, 1404, 7356, 594, 810, 3546, 2214
Offset: 1

Views

Author

Keywords

Comments

Differences between primes that are palindromic in base 3.

Examples

			a(4) = 22 = A029971(5)-A029971(4).
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=FromDigits[RealDigits[n,3][[1]]]==FromDigits[Reverse[RealDigits[n, 3][[1]]]]; a=2;lst={};Do[p=Prime[n];If[f[p],AppendTo[lst,p-a];a=p], {n,1,8!,1}];lst

Extensions

Definition simplified, initial 0 removed by R. J. Mathar, Nov 17 2009

A207039 Primes whose binary expansion is not palindromic.

Original entry on oeis.org

2, 11, 13, 19, 23, 29, 37, 41, 43, 47, 53, 59, 61, 67, 71, 79, 83, 89, 97, 101, 103, 109, 113, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 263, 269, 271, 277, 281, 283, 293, 307, 311, 317
Offset: 1

Views

Author

Omar E. Pol, Feb 25 2012

Keywords

Comments

Intersection of A000040 and A154809.

Crossrefs

Primes in A154809.

Programs

A230820 Table, read by antidiagonals, of palindromic primes in base b expressed in decimal.

Original entry on oeis.org

3, 2, 5, 2, 13, 7, 2, 3, 23, 17, 2, 3, 5, 151, 31, 2, 3, 31, 17, 173, 73, 2, 3, 5, 41, 29, 233, 107, 2, 3, 5, 7, 67, 59, 757, 127, 2, 3, 5, 71, 37, 83, 257, 937, 257, 2, 3, 5, 7, 107, 43, 109, 373, 1093, 313, 2, 3, 5, 7, 73, 157, 61, 701, 409, 1249, 443
Offset: 1

Views

Author

Robert G. Wilson v, Oct 30 2013

Keywords

Examples

			\r
b\
.2.3...5...7...17...31...73..107..127...257...313...443..1193..1453..1571.=A016041
.3.2..13..23..151..173..233..757..937..1093..1249..1429..1487..1667..1733.=A029971
.4.2...3...5...17...29...59..257..373...409...461...509...787...839...887.=A029972
.5.2...3..31...41...67...83..109..701...911..1091..1171..1277..1327..1667.=A029973
.6.2...3...5....7...37...43...61...67...191...197..1297..1627..1663..1699.=A029974
.7.2...3...5...71..107..157..257..271...307..2549..2647..2801..3347..3697.=A029975
.8.2...3...5....7...73...89...97..113...211...227...251...349...373...463.=A029976
.9.2...3...5....7..109..127..173..191...227...337...373...419...601...619.=A029977
10.2...3...5....7...11..101..131..151...181...191...313...353...373...383.=A002385
11.2...3...5....7..199..277..421..443...499...521...587...643...709...743.=A029978
12.2...3...5....7...11...13..157..181...193...229...241...277...761...773.=A029979
...
inf..2..3..5..7..11..13..17..19..23..29..31..37..41..43..47..53..59..61...=A000040
		

Crossrefs

Programs

  • Maple
    A230820 := proc(b,n)
        option remember;
        local a,dgs ;
        if n = 1 then
            if b = 2 then
                return 3;
            else
                return 2;
            end if;
        else
            for a from procname(b,n-1)+1 do
                if isprime(a) then
                    ispal := true ;
                    dgs := convert(a,base,b) ;
                    for i from 1 to nops(dgs)/2 do
                        if op(i,dgs) <> op(-i,dgs) then
                            ispal := false;
                        end if;
                    end do:
                    if ispal then
                        return a;
                    end if;
                end if;
            end do:
        end if;
    end proc:
    for b from 2 to 9 do
        for n from 1 to 9 do
            printf("%3d ",A230820(b,n)) ;
        end do:
        printf("\n") ;
    end do; # R. J. Mathar, Feb 16 2014
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[ n, base]}, idn == Reverse@ idn]; Table[Select[Prime@Range@500, palQ[#, k + 1] &][[b - k + 1]], {b, 11}, {k, b, 1, -1}] // Flatten
Previous Showing 11-20 of 34 results. Next