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.

A047814 Largest prime substring of n, or 0 if no such substring exists.

Original entry on oeis.org

0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 2, 13, 0, 5, 0, 17, 0, 19, 2, 2, 2, 23, 2, 5, 2, 7, 2, 29, 3, 31, 3, 3, 3, 5, 3, 37, 3, 3, 0, 41, 2, 43, 0, 5, 0, 47, 0, 0, 5, 5, 5, 53, 5, 5, 5, 7, 5, 59, 0, 61, 2, 3, 0, 5, 0, 67, 0, 0, 7, 71, 7, 73, 7, 7, 7, 7, 7, 79, 0, 0, 2, 83, 0, 5, 0, 7, 0, 89
Offset: 0

Views

Author

Keywords

Comments

A211396(n) <= a(n). - Reinhard Zumkeller, Feb 08 2013

Examples

			a(10)=0, a(1227)=227.
		

Crossrefs

Cf. A211396.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a047814 n = if null ips then 0 else head ips
       where ips = [p | p <- reverse $ takeWhile (<= n) a000040_list,
                        show p `isInfixOf` show n]
    -- Reinhard Zumkeller, Feb 08 2013
  • Mathematica
    a[n_] := (id = IntegerDigits[n]; lg = Length[id]; sel = Select[ FromDigits /@ Flatten[ Table[ id[[i ;; j]], {i, 1, lg}, {j, i, lg}], 1], PrimeQ]; If[ sel === {}, 0, Last[ Sort[ sel] ] ]); Table[ a[n], {n, 0, 99}] (* Jean-François Alcover, Feb 23 2012 *)
    lps[m_]:=Max[Select[Flatten[Table[FromDigits/@Partition[ IntegerDigits[ m],n,1],{n,IntegerLength[m]}]],PrimeQ]]; Array[lps,100,0]/. -\[Infinity]->0 (* Harvey P. Dale, Feb 26 2014 *)

Extensions

Corrected (41) by Jean-François Alcover, Feb 23 2012