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.

A030675 Smallest nontrivial extension of n-th palindrome which is a prime.

Original entry on oeis.org

11, 23, 31, 41, 53, 61, 71, 83, 97, 113, 223, 331, 443, 557, 661, 773, 881, 991, 1013, 1117, 1213, 1319, 14107, 1511, 1613, 17107, 1811, 1913, 2027, 2129, 2221, 23201, 2423, 2521, 2621, 2729, 28201, 2927, 3037, 3137, 32303, 3331, 3433
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    lpe:= proc(n) local b,d,x;
      for d from 1 do
        b:= 10^d*n;
        for x from b+1 to b+10^d-1 by 2 do
          if isprime(x) then return x fi
        od
      od
    end proc:
    digrev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    N:= 4: # to use all palindromes of up to N digits
    Res:= seq(lpe(n),n=1..9):
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Res:= Res, seq(lpe(n*10^m + digrev(n)), n=10^(m-1)..10^m-1);
      else
        m:= (d-1)/2;
        Res:= Res, seq(seq(lpe(n*10^(m+1)+y*10^m+digrev(n)), y=0..9), n=10^(m-1)..10^m-1);
      fi
    od:
    Res; # Robert Israel, Sep 18 2018
  • Mathematica
    d[n_]:=IntegerDigits[n]; Table[i=1; While[!PrimeQ[x=FromDigits[Flatten[{d[n],d[i]}]]],i=i+2]; x, {n,Select[Range[350],Reverse[x=d[#]]==x &]}]  (* Jayanta Basu, May 24 2013 *)

Formula

a(n) = A030665(A002113(n+1)). - Robert Israel, Sep 18 2018

Extensions

Corrected by Robert Israel, Sep 18 2018