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.
%I A062584 #52 Dec 04 2021 12:13:03 %S A062584 101,11,2,3,41,5,61,7,83,19,101,11,127,13,149,151,163,17,181,19,1201, %T A062584 211,223,23,241,251,263,127,281,29,307,31,1321,233,347,353,367,37,383, %U A062584 139,401,41,421,43,443,457,461,47,487,149,503,151,521,53,541,557,563 %N A062584 a(n) is the smallest prime whose digits include the digits of n as a substring. %C A062584 a(0) = 101 is the first term where a(n) has two more digits than n. a(665808) = 106658081 is the first term where a(n) has three more digits than n. For which n does a(n) first have four more digits than n? Is lim sup a(n)/n infinite? - _Charles R Greathouse IV_, Jun 23 2017 %C A062584 Decide how many elements you want to find. Then for every prime, check all substrings to see if they are the first to be in some n. If you've found all values a(n), then you want to stop. - _David A. Corneth_, Jun 24 2017 %H A062584 Reinhard Zumkeller, <a href="/A062584/b062584.txt">Table of n, a(n) for n = 0..10000</a> %H A062584 <a href="/index/Pri#piden">Index entries for primes involving decimal expansion of n</a> %F A062584 a(n) = prime(A082058(n)). - _Giovanni Resta_, Apr 29 2017 %e A062584 0 first occurs in 101. 14 first occurs as a substring in 149. %t A062584 Do[k = 1; While[ StringPosition[ ToString[Prime[k]], ToString[n]] == {}, k++ ]; Print[ Prime[k]], {n, 0, 62} ] %t A062584 (* Second program *) %t A062584 Function[s, Table[FromDigits@ FirstCase[s, w_ /; SequenceCount[w, IntegerDigits@ n] > 0], {n, 0, 56}]]@ IntegerDigits@ Prime@ Range[10^4] (* _Michael De Vlieger_, Jun 24 2017 *) %t A062584 With[{prs=Prime[Range[300]]},Table[SelectFirst[prs,SequenceCount[ IntegerDigits[#], IntegerDigits[ n]]>0&],{n,0,60}]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Dec 06 2018 *) %o A062584 (Haskell) %o A062584 import Data.List (isInfixOf) %o A062584 a062584 n = head [p | p <- a000040_list, show n `isInfixOf` show p] %o A062584 -- _Reinhard Zumkeller_, Dec 29 2011 %o A062584 (PARI) build(root, prefixLen, suffixLen)=my(v=List(),t); for(i=10^(prefixLen-1)\1,10^prefixLen-1, t=eval(Str(i,root))*10^suffixLen; for(n=t,t+10^suffixLen-1, listput(v,n))); Vec(v) %o A062584 buildLen(n,d)=my(v=[]); for(i=0,d, v=concat(v,build(n,i,d-i))); Set(v) %o A062584 a(n)=if(n==0, return(101)); my(d,v); while(1, v=buildLen(n,d); for(i=1,#v, if(isprime(v[i]), return(v[i]))); d++) \\ _Charles R Greathouse IV_, Jun 23 2017 %o A062584 (PARI) first(n) = my(res = vector(n), todo = n, g); forprime(p = 2, , d = digits(p); for(i=1,#d, if(d[i]!=0, g = d[i]; if(res[g]==0, res[g]=p; todo--); for(j=1,#d-i, g=10*g+d[i+j]; if(g>n,next(2)); if(res[g]==0, res[g]=p; todo--)))); if(todo==0,return(concat([101],res)))) \\ _David A. Corneth_, Jun 23 2017 %o A062584 (Python) %o A062584 from sympy import nextprime %o A062584 def a(n): %o A062584 p, s = 2, str(n) %o A062584 while s not in str(p): p = nextprime(p) %o A062584 return p %o A062584 print([a(n) for n in range(57)]) # _Michael S. Branicky_, Dec 02 2021 %Y A062584 Cf. A082058, A018800, A060386. Similar to but different from A068164. E.g., a(133) = 4133, but A068164(133) = 1033. %K A062584 easy,nonn,base,nice %O A062584 0,1 %A A062584 _Jason Earls_, Jul 03 2001 %E A062584 More terms from _Lior Manor_, Jul 08 2001 %E A062584 Corrected by Larry Reeves (larryr(AT)acm.org), Jul 10 2001 %E A062584 Further correction from _Reinhard Zumkeller_, Oct 14 2001 %E A062584 Name clarified by _Jon E. Schoenfield_, Dec 04 2021