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.

A246398 Smallest number of digits that have to be inserted into or prepended to decimal representation of n, to get a prime.

This page as a plain text file.
%I A246398 #7 Nov 13 2014 23:57:14
%S A246398 2,1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,2,1,0,0,1,1,1,1,1,0,1,0,2,0,
%T A246398 1,1,1,0,1,1,1,0,1,0,0,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,0,2,1,1,1,0,0,
%U A246398 1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,2,1
%N A246398 Smallest number of digits that have to be inserted into or prepended to decimal representation of n, to get a prime.
%C A246398  a(n) = 0 iff n is a prime number, a(A000040(n)) = 0;
%C A246398 a(n) = A055642(A062584(n)) - A055642(n).
%H A246398 Reinhard Zumkeller, <a href="/A246398/b246398.txt">Table of n, a(n) for n = 0..10000</a>
%o A246398 (Haskell)
%o A246398 a246398 n = a246398_list !! n
%o A246398 a246398_list = f 0 $ map show a000040_list where
%o A246398    f x pss = (length ps - length xs) :
%o A246398              f (x + 1) (dropWhile (== xs) pss)
%o A246398      where ps = head [qs | qs <- pss, isin xs qs]; xs = show x
%o A246398    isin [] _  = True
%o A246398    isin _  [] = False
%o A246398    isin (u:us) vs = not (null ws) && isin us ws
%o A246398                     where ws = dropWhile (/= u) vs
%Y A246398 Cf. A000040, A055642, A062584, A068164.
%K A246398 nonn,base
%O A246398 0,1
%A A246398 _Reinhard Zumkeller_, Nov 13 2014