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.

A046942 Numbers k such that k and prime(k) are both palindromes.

Original entry on oeis.org

1, 2, 3, 4, 5, 8114118, 535252535, 4025062605204
Offset: 1

Views

Author

Keywords

Comments

Previous name: Indices of primes appearing in A046941.
Also, intersection of A002113 and A075807. - Ivan Neretin, Jun 02 2016

Crossrefs

Programs

  • Mathematica
    NextPalindrome[n_] := Block[ {l = Floor[ Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[ idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[ idn, Ceiling[l/2]]]] FromDigits[ Take[ idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[ idn, Ceiling[l/2]], Reverse[ Take[ idn, Floor[l/2]]] ]], idfhn = FromDigits[ Take[ idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[ idfhn], Drop[ Reverse[ IntegerDigits[ idfhn]], Mod[l, 2]]]] ]]]];
    p = 0; Do[p = NextPalindrome[p]; While[ !PrimeQ[p], p = NextPalindrome[ p]]; q = IntegerDigits[ PrimePi[ p]]; If[Reverse[q] == q, Print[{p, FromDigits[q]}]], {n, 10^4}] (* Robert G. Wilson v, Feb 03 2005 *)
    ParallelDo[If [PalindromeQ @ i && PalindromeQ @ Prime @i, Print @i], {i, 6*10^8}] (* Mikk Heidemaa, May 24 2024 *)

Extensions

a(7) from Giovanni Resta, May 14 2003
New name and offset by Ivan Neretin, Jun 02 2016
a(8) from Giovanni Resta, Aug 10 2019

A068396 n-th prime minus its reversal.

Original entry on oeis.org

0, 0, 0, 0, 0, -18, -54, -72, -9, -63, 18, -36, 27, 9, -27, 18, -36, 45, -9, 54, 36, -18, 45, -9, 18, 0, -198, -594, -792, -198, -594, 0, -594, -792, -792, 0, -594, -198, -594, -198, -792, 0, 0, -198, -594, -792, 99, -99, -495
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 08 2002

Keywords

Comments

a(n) = 0 for n in A075807. - Michel Marcus, Sep 27 2017
All terms are divisible by 9. - Zak Seidov, Jun 05 2021

Examples

			a(10) = 29 - 92 = -63;
a(20) = 71 - 17 = 54.
		

Crossrefs

Programs

  • Haskell
    a068396 n = p - a004086 p  where p = a000040 n
    -- Reinhard Zumkeller, Feb 04 2014
    
  • Mathematica
    #-IntegerReverse[#]& /@ Prime[Range[50]] (* Harvey P. Dale, Dec 20 2012 *)
  • PARI
    a(n) = prime(n) - fromdigits(Vecrev(digits(prime(n)))); \\ Michel Marcus, Sep 27 2017
    
  • Python
    from sympy import prime
    def a(n): pn = prime(n); return pn - int(str(pn)[::-1])
    print([a(n) for n in range(1, 50)]) # Michael S. Branicky, Jun 05 2021

Formula

a(n) = A000040(n) - A004087(n).
a(n) = A056965(A000040(n)). - Michel Marcus, Sep 27 2017

A069469 Numbers k such that prime(reversal(k)) = reversal(prime(k)). Ignore leading 0's.

Original entry on oeis.org

1, 2, 3, 4, 5, 12, 21, 8114118, 535252535
Offset: 1

Views

Author

Joseph L. Pe, Apr 15 2002

Keywords

Comments

For an arithmetical function f, call the arguments n such that f(reverse(n)) = reverse(f(n)) the "palinpoints" of f. This sequence is the sequence of palinpoints of f(n) = prime(n).
These are all the palinpoints of prime(n) not exceeding 10^7. There are more (535252535 is known to be a term, but it is not known whether it is the next one).
Contains all n such that n and prime(n) are both palindromes, i.e. A046942. Heuristically, we would expect there to be infinitely many of these, but they will be rare: the number of them with at most d digits may be on the order of sqrt(d). - Robert Israel, May 30 2016
a(10) > 10^9. - Giovanni Resta, Apr 13 2017

Examples

			Let f(n) = prime(n). Then f(21) = 73, f(12) = 37, so f(reverse(21)) = reverse(f(21)). Therefore 21 belongs to the sequence.
		

Crossrefs

Programs

  • Mathematica
    rev[n_] := FromDigits[Reverse[IntegerDigits[n]]]; f[n_] := Prime[n]; Select[Range[10^5], f[rev[ # ]] == rev[f[ # ]] &]

Extensions

a(8) added by Ivan Neretin, May 30 2016
a(9) from Giovanni Resta, Apr 13 2017

A309321 The number of primes between two consecutive palindromic primes, bounds excluded.

Original entry on oeis.org

0, 0, 0, 0, 20, 5, 3, 5, 0, 21, 5, 2, 1, 52, 4, 3, 0, 17, 0, 1104, 21, 7, 73, 9, 105, 35, 8, 54, 51, 11, 34, 43, 78, 8, 52, 29, 19, 10, 80, 50, 22, 33, 78, 53, 9, 994, 11, 17, 26, 7, 20, 49, 75, 12, 109, 100, 27, 16, 12, 16, 32, 48, 28, 69, 32, 42, 6, 56, 48
Offset: 1

Views

Author

Hauke Löffler, Jul 23 2019

Keywords

Examples

			a(0): Between the first two palindromic primes (2,3) there are 0 primes.
a(6): Between 101 and 131 there are 5 primes (103, 107, 109, 113, 127).
		

Crossrefs

Programs

  • SageMath
    #Palindromic primes
    def count_primes_between(a,b):
        return len(prime_range(a+1,b))
    [count_primes_between(A002385[i],A002385[i+1]) for i in range (len(A002385)-1)]
    # Alternative:
    def A309321list(bound):
        L = []; p = 2
        while p < bound:
            p = next_prime(p)
            delta = 0
            while not Word(p.digits()).is_palindrome():
                delta += 1
                p = next_prime(p)
            L.append(delta)
        return L
    A309321list(18181) # Peter Luschny, Jul 23 2019

Formula

a(n) = A075807(n+1) - A075807(n) - 1. - Jinyuan Wang, Jul 24 2019

A124232 Numbers n such that prime(n) and pi(n) are palindromic.

Original entry on oeis.org

1, 2, 3, 4, 5, 26, 32, 36, 138, 3691, 6987, 7193, 86969, 117766, 127150, 142583, 515786, 531448, 539596, 615980, 646060, 17262354, 39816443, 47548105, 48803361, 49426747, 528977302, 538348374, 1475057753, 1559827952, 2994135736, 60040412496, 64516992534, 333771325433, 11655934712628, 21872729899659, 22903935103276, 28311805106395, 29606335619415
Offset: 1

Views

Author

Tanya Khovanova, Dec 13 2006

Keywords

Crossrefs

Subsequence of A075807 = numbers n such that n-th prime is palindromic.

Programs

  • Mathematica
    NextPalindrome[n_] := Block[{lg = Floor@ Log[10, n] + 1, idn = IntegerDigits@n}, If[Union@ idn == {9}, Return[n + 2], If[lg < 2, Return[n + 1], If[ FromDigits@ Reverse@ Take[idn, Ceiling[lg/2]] > FromDigits@ Take[idn, -Ceiling[lg/2]], FromDigits@ Join[ Take[idn, Ceiling[lg/2]], Reverse@ Take[idn, Floor[lg/2]]], idfhn = FromDigits@ Take[idn, Ceiling[lg/2]] + 1; idp = FromDigits@ Join[IntegerDigits@ idfhn, Drop[ Reverse@ IntegerDigits@ idfhn, Mod[lg, 2]]] ]]]];
    palQ[n_Integer] := Module[{idn = IntegerDigits@n}, idn == Reverse@ idn]; lst = {}; k = 1; While[k < 10^12, If[ PrimeQ@k && palQ@PrimePi@PrimePi@k, Print@PrimePi@k; AppendTo[lst, PrimePi@k]]; k = NextPalindrome@k]; lst (* Robert G. Wilson v *)

Extensions

a(22) - a(31) from Robert G. Wilson v, Dec 14 2006
a(32)-a(33) from Donovan Johnson, Jul 19 2012
a(34) from Chai Wah Wu, Sep 12 2019
a(35)-a(39) from Chai Wah Wu, Sep 19 2019
Showing 1-5 of 5 results.