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

A062584 a(n) is the smallest prime whose digits include the digits of n as a substring.

Original entry on oeis.org

101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 127, 13, 149, 151, 163, 17, 181, 19, 1201, 211, 223, 23, 241, 251, 263, 127, 281, 29, 307, 31, 1321, 233, 347, 353, 367, 37, 383, 139, 401, 41, 421, 43, 443, 457, 461, 47, 487, 149, 503, 151, 521, 53, 541, 557, 563
Offset: 0

Views

Author

Jason Earls, Jul 03 2001

Keywords

Comments

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
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

Examples

			0 first occurs in 101. 14 first occurs as a substring in 149.
		

Crossrefs

Cf. A082058, A018800, A060386. Similar to but different from A068164. E.g., a(133) = 4133, but A068164(133) = 1033.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a062584 n = head [p | p <- a000040_list, show n `isInfixOf` show p]
    -- Reinhard Zumkeller, Dec 29 2011
    
  • Mathematica
    Do[k = 1; While[ StringPosition[ ToString[Prime[k]], ToString[n]] == {}, k++ ]; Print[ Prime[k]], {n, 0, 62} ]
    (* Second program *)
    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 *)
    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 *)
  • 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)
    buildLen(n,d)=my(v=[]); for(i=0,d, v=concat(v,build(n,i,d-i))); Set(v)
    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
    
  • 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
    
  • Python
    from sympy import nextprime
    def a(n):
        p, s = 2, str(n)
        while s not in str(p): p = nextprime(p)
        return p
    print([a(n) for n in range(57)]) # Michael S. Branicky, Dec 02 2021

Formula

a(n) = prime(A082058(n)). - Giovanni Resta, Apr 29 2017

Extensions

More terms from Lior Manor, Jul 08 2001
Corrected by Larry Reeves (larryr(AT)acm.org), Jul 10 2001
Further correction from Reinhard Zumkeller, Oct 14 2001
Name clarified by Jon E. Schoenfield, Dec 04 2021

A346120 a(n) is the smallest nonnegative number k such that the decimal expansion of k! contains the string n.

Original entry on oeis.org

5, 0, 2, 8, 4, 7, 3, 6, 9, 11, 19, 22, 5, 15, 26, 25, 11, 14, 27, 29, 5, 19, 13, 18, 4, 23, 26, 13, 9, 14, 15, 32, 8, 24, 28, 17, 9, 18, 23, 11, 7, 27, 17, 15, 21, 19, 26, 12, 24, 23, 7, 19, 23, 32, 29, 17, 17, 18, 23, 25, 12, 26, 9, 26, 18, 30, 20, 15, 11, 27, 13
Offset: 0

Views

Author

Ilya Gutkovskiy, Jul 05 2021

Keywords

Examples

			a(3) = 8 since 3 occurs in 8! = 40320, but not in 0!, 1!, 2!, ..., 7!.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := (k = 0; While[! MatchQ[IntegerDigits[k!], {_, Sequence @@ IntegerDigits[n], _}], k++]; k); Table[a[n], {n, 0, 70}]
  • PARI
    a(n) = my(k=0, s=Str(n)); while (#strsplit(Str(k!), s) < 2, k++); k; \\ Michel Marcus, Jul 05 2021
    
  • Python
    def A346120(n):
        s, k, f = str(n), 0, 1
        while s not in str(f):
            k += 1
            f *= k
        return k # Chai Wah Wu, Jul 05 2021

A377483 Smallest index k such that prime(k) in base-2 contains n in base-2 as a contiguous substring.

Original entry on oeis.org

1, 1, 2, 7, 3, 6, 4, 7, 8, 13, 5, 24, 6, 10, 11, 19, 7, 12, 8, 13, 14, 24, 9, 25, 24, 16, 17, 30, 10, 18, 11, 32, 19, 33, 20, 21, 12, 63, 22, 38, 13, 68, 14, 24, 29, 70, 15, 25, 30, 26, 27, 47, 16, 29, 48, 30, 50, 51, 17, 53, 18, 54, 31, 55, 32, 77, 19, 33, 34, 60, 20, 79
Offset: 1

Views

Author

Charles Marsden, Oct 29 2024

Keywords

Comments

The intersections between this sequence and similar sequences in base-B occur at values of n that are the sequence of prime numbers, and values of a(n) that are the sequence of positive integers.

Examples

			For n=1 -> 1 in base-2. The first prime containing 1 in its base-2 form is prime(1)=2 -> 10. Therefore, a(1)=1.
For n=3 -> 11 in base-2. The first prime containing 11 in its base-2 form is prime(2)=3 -> 11. Therefore, a(3)=2.
For n=5 -> 101 in base-2. The first prime containing 101 in its base-2 form is prime(3)=5 -> 101. Therefore, a(5)=3.
		

Crossrefs

Programs

  • Mathematica
    s={}; Do[k=0;Until[SequenceCount[IntegerDigits[Prime[k],2],IntegerDigits[n,2]]>0,k++]; AppendTo[s,k],{n,72}];s (* James C. McMahon, Nov 20 2024 *)
  • PARI
    a(n) = { my (w = 2^#binary(n), k = 0, r); forprime (p = 2, oo, k++; r = p; while (r >= n, if (r % w == n, return (k), r \= 2;););); } \\ Rémy Sigrist, Nov 20 2024
  • Python
    # See links.
    
  • Python
    from sympy import nextprime, primepi
    def A377483(n):
        p, k, a = nextprime(n-1), primepi(n-1)+1, bin(n)[2:]
        while True:
            if a in bin(p)[2:]:
                return k
            p = nextprime(p)
            k += 1 # Chai Wah Wu, Nov 20 2024
    

A346203 a(n) is the smallest nonnegative number k such that the decimal expansion of the product of the first k primes contains the string n.

Original entry on oeis.org

3, 0, 1, 3, 10, 7, 2, 9, 9, 8, 4, 18, 17, 11, 15, 16, 14, 18, 24, 16, 11, 4, 9, 5, 21, 13, 13, 13, 9, 21, 3, 5, 10, 14, 12, 13, 26, 24, 12, 17, 18, 15, 12, 26, 16, 22, 10, 16, 12, 11, 13, 7, 13, 20, 17, 19, 11, 20, 15, 18, 11, 14, 21, 13, 10, 24, 20, 14, 21, 8, 9
Offset: 0

Views

Author

Ilya Gutkovskiy, Jul 10 2021

Keywords

Examples

			a(5) = 7 since 5 occurs in prime(7)# = 2 * 3 * 5 * 7 * 11 * 13 * 17 = 510510, but not in prime(0)#, prime(1)#, prime(2)#, ..., prime(6)#.
		

Crossrefs

Programs

  • Mathematica
    primorial[n_] := Product[Prime[j], {j, 1, n}]; a[n_] := (k = 0; While[! MatchQ[IntegerDigits[primorial[k]], {_, Sequence @@ IntegerDigits[n], _}], k++]; k); Table[a[n], {n, 0, 70}]
  • PARI
    a(n) = my(k=0, p=1, q=1, sn=Str(n)); while (#strsplit(Str(q), sn)==1, k++; p=nextprime(p+1); q*=p); k; \\ Michel Marcus, Jul 13 2021; corrected Jun 15 2022
  • Python
    from sympy import nextprime
    def A346203(n):
        m, k, p, s = 1, 0, 1, str(n)
        while s not in str(m):
            k += 1
            p = nextprime(p)
            m *= p
        return k # Chai Wah Wu, Jul 12 2021
    
Showing 1-4 of 4 results.