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

A338715 Smallest prime ending with decimal expansion of n, for n relatively prime to 10.

Original entry on oeis.org

11, 3, 7, 19, 11, 13, 17, 19, 421, 23, 127, 29, 31, 233, 37, 139, 41, 43, 47, 149, 151, 53, 157, 59, 61, 163, 67, 269, 71, 73, 277, 79, 181, 83, 487, 89, 191, 193, 97, 199, 101, 103, 107, 109, 2111, 113, 1117, 3119, 3121, 1123, 127, 1129, 131, 4133, 137, 139, 2141, 2143, 5147, 149, 151, 1153, 157
Offset: 1

Views

Author

N. J. A. Sloane, Nov 11 2020

Keywords

Comments

a(n) exists by Dirichlet's theorem.

Crossrefs

Cf. A045572, A105888 (base 2 equivalent), A258190.
See A245193, A337834, A338716 for other versions.

Programs

  • Maple
    N:= 100: # for a(1) to a(N)
    V:= Vector(N):
    count:= 0:
    for n from 1 while count < N do
      if igcd(n,10)=1 then
        count:= count+1;
        d:= ilog10(n)+1;
        for x from n by 10^d do
          if isprime(x) then V[count]:= x; break fi
        od
      fi
    od:
    convert(V,list); # Robert Israel, Nov 11 2020
  • Python
    from sympy import isprime
    def a(n):
        ending = 2*n - 1 + (n+1)//4 * 2 # A045572
        i, pow10 = ending, 10**len(str(ending))
        while not isprime(i): i += pow10
        return i
    print([a(n) for n in range(1, 64)]) # Michael S. Branicky, Nov 03 2021

Extensions

More terms from Robert Israel, Nov 11 2020

A258337 Smallest prime starting with n that does not appear earlier.

Original entry on oeis.org

11, 2, 3, 41, 5, 61, 7, 83, 97, 101, 113, 127, 13, 149, 151, 163, 17, 181, 19, 2003, 211, 223, 23, 241, 251, 263, 271, 281, 29, 307, 31, 3203, 331, 347, 353, 367, 37, 383, 397, 401, 419, 421, 43, 443, 457, 461, 47, 487, 491, 503, 5101, 521, 53, 541, 557, 563, 571, 587, 59, 601, 613, 6203, 631, 641, 653, 661, 67, 683, 691, 701
Offset: 1

Views

Author

Vladimir Shevelev, May 27 2015

Keywords

Comments

According to a comment in A018800, every term exists. So the sequence is a permutation of the primes. Indeed, every prime p appears in the sequence either as the p-th term or earlier.

Crossrefs

Programs

  • Haskell
    import Data.List (isPrefixOf, delete)
    a258337 n = a258337_list !! (n-1)
    a258337_list = f 1 $ map show a000040_list where
       f x pss = g pss where
         g (qs:qss) = if show x `isPrefixOf` qs
                         then (read qs :: Int) : f (x + 1) (delete qs pss)
                         else g qss
    -- Reinhard Zumkeller, Jul 01 2015
  • Maple
    N:= 100: # to get a(1) to a(N)
    for n from 1 to N do
      p:= n;
      if n < 10 then
        p1:= 0
      else
        p1:= A[floor(n/10)];
      fi;
      if isprime(p) and p > p1 then
         A[n]:= p
      else
        for d from 1 while not assigned(A[n]) do
          for i from 1 to 10^d-1 do
            p:= 10^d*n+i;
            if p > p1 and isprime(p) then
               A[n]:= p;
               break
            fi;
          od
        od
      fi
    od:
    seq(A[i],i=1..N); # Robert Israel, Jun 29 2015
  • PARI
    sw(m,n)=d1=digits(n);d2=digits(m);for(i=1,min(#d1,#d2),if(d1[i]!=d2[i],return(0)));1
    v=[];n=1;while(n<70,k=1;while(k<10^3,p=prime(k);if(sw(p,n)&&!vecsearch(vecsort(v),p),v=concat(v,p);k=0;n++);k++));v \\ Derek Orr, Jun 13 2015
    

Formula

For n>=2, a(n) >= prime(n-1). The equality holds iff prime(n-1) did not already appear as a(k), k
Showing 1-2 of 2 results.