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.

A258339 PrimePi(A258337(n)).

Original entry on oeis.org

5, 1, 2, 13, 3, 18, 4, 23, 25, 26, 30, 31, 6, 35, 36, 38, 7, 42, 8, 304, 47, 48, 9, 53, 54, 56, 58, 60, 10, 63, 11, 453, 67, 69, 71, 73, 12, 76, 78, 79, 81, 82, 14, 86, 88, 89, 15, 93, 94, 96, 682, 98, 16, 100, 102, 103, 105, 107, 17, 110, 112, 807, 115, 116, 119, 121, 19, 124, 125, 126, 20, 129, 21, 132, 133, 135, 137, 138, 22, 140, 141, 142, 146, 1052, 147, 150
Offset: 1

Views

Author

Vladimir Shevelev, May 27 2015

Keywords

Comments

The sequence is a permutation of the positive numbers.

Crossrefs

Formula

a(n) >= PrimePi(n).

A018800 Smallest prime that begins with n.

Original entry on oeis.org

11, 2, 3, 41, 5, 61, 7, 83, 97, 101, 11, 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, 41, 421, 43, 443, 457, 461, 47, 487, 491, 503, 5101, 521, 53, 541, 557, 563, 571, 587, 59
Offset: 1

Views

Author

Keywords

Comments

Conjecture: If a(n) = (n concatenated with k) then k < n. - Amarnath Murthy, May 01 2002
a(n) always exists. Proof. Suppose n is L digits long, and consider the numbers between n*10^B and n*10^B+10^C, where B > C are both large compared with L. All such numbers begin with the digits of n. Using the upper and lower bounds on pi(x) from Theorem 1 of Rosser and Schoenfeld, it follows that for sufficiently large B and C, at least one of these numbers is a prime. QED - N. J. A. Sloane, Nov 14 2014

Crossrefs

A164022 is the base-2 analog.
Cf. also A258337.
Row n=1 of A262369.

Programs

  • Haskell
    import Data.List (isPrefixOf, find); import Data.Maybe (fromJust)
    a018800 n = read $ fromJust $
                find (show n `isPrefixOf`) $ map show a000040_list :: Int
    -- Reinhard Zumkeller, Jul 01 2015
    
  • Maple
    f:= proc(n) local x0, d,r,y;
       if isprime(n) then return(n) fi;
       for d from 1 do
         x0:= n*10^d;
         for r from 1 to 10^d-1 by 2 do
           if isprime(x0+r) then
              return(x0+r)
           fi
         od
       od
    end proc:
    seq(f(n),n=1..100); # Robert Israel, Dec 23 2014
  • Mathematica
    Table[Function[d, FromDigits@ SelectFirst[ IntegerDigits@ Prime@ Range[10^4], Length@ # >= Length@ d && Take[#, Length@ d] == d &]][ IntegerDigits@ n], {n, 59}] (* Michael De Vlieger, May 24 2016, Version 10 *)
  • PARI
    a(n{,base=10}) = for (l=0, oo, forprime (p=n*base^l, (n+1)*base^l-1, return (p))) \\ Rémy Sigrist, Jun 11 2017
    
  • Python
    from sympy import isprime
    def a(n):
        if isprime(n): return n
        pow10 = 10
        while True:
            t, maxt = n * pow10 + 1, (n+1) * pow10
            while t < maxt:
                if isprime(t): return t
                t += 2
            pow10 *= 10
    print([a(n) for n in range(1, 60)]) # Michael S. Branicky, Nov 02 2021

Formula

a(n) = prime(A085608(n)). - Michel Marcus, Oct 19 2013
Showing 1-2 of 2 results.