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-1 of 1 results.

A186698 Next prime after n-th positive palindrome.

Original entry on oeis.org

2, 3, 5, 5, 7, 7, 11, 11, 11, 13, 23, 37, 47, 59, 67, 79, 89, 101, 103, 113, 127, 137, 149, 157, 163, 173, 191, 193, 211, 223, 223, 233, 251, 257, 263, 277, 283, 293, 307, 317, 331, 337, 347, 359, 367, 379, 389, 397, 409, 419, 431, 439, 449, 457, 467, 479, 487, 499, 509, 521, 541, 541, 547, 557, 569, 577, 587, 599, 607, 617, 631, 641, 647
Offset: 1

Views

Author

Harvey P. Dale, Feb 25 2011

Keywords

Comments

There are infinitely many n for which a(n+1) = a(n). For example, when 10^k + 1 is composite, 10^k - 1 and 10^k + 1 are successive palindromes which have the same next prime. - Robert Israel, Nov 04 2015

Crossrefs

Programs

  • Maple
    digrev:= proc(x) option remember; local t;
       t:= x mod 10;
       t*10^ilog10(x)+procname((x-t)/10)
    end proc:
    for x from 0 to 9 do digrev(x):= x od:
    N:=6;
    Pals:= $1..9:
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Pals:= Pals, seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1);
      else
        m:= (d-1)/2;
        Pals:= Pals, seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1);
      fi
    od:
    Pals:=[Pals]:
    map(nextprime,Pals); # Robert Israel, Nov 04 2015
  • Mathematica
    NextPrime[Select[Range[700],PalindromeQ]] (* Harvey P. Dale, Jan 31 2024 *)
  • Python
    from sympy import nextprime
    def A186698(n): return int(nextprime((c:=n+1-x)*x+int(str(c)[-2::-1] or 0) if n+1<(x:=10**(len(str(n+1>>1))-1))+(y:=10*x) else (c:=n+1-y)*y+int(str(c)[::-1] or 0))) # Chai Wah Wu, Jul 10 2024

Formula

a(n) = A151800(A002113(n+1)). - Michael S. Branicky, Jul 10 2024
Showing 1-1 of 1 results.