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-10 of 23 results. Next

A113616 Erroneous version of A062584.

Original entry on oeis.org

11, 2, 3, 41, 5, 61, 7, 83, 97, 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, 157
Offset: 1

Views

Author

Keywords

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

A068164 Smallest prime obtained from n by inserting zero or more decimal digits.

Original entry on oeis.org

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, 157
Offset: 1

Views

Author

Amarnath Murthy, Feb 25 2002

Keywords

Comments

The digits may be added before, in the middle of, or after the digits of n.
a(n) = n for prime n, by definition. - Zak Seidov, Nov 13 2014
a(n) always exists. Proof. Suppose n is L digits long, and let n' = 10*n+1. The arithmetic progression k*10^(2L)+n' (k >= 0) contains infinitely many primes, by Dirichlet's theorem, and they all contain the digits of n. QED. - Robert Israel, Nov 13 2014. For another proof, see A018800.
Similar to but different from A062584. E.g. a(133) = 1033, but A062584(133) = 4133.

Examples

			Smallest prime formed from 20 is 1201, by placing 1 on both sides. Smallest prime formed from 33 is 233, by placing a 2 in front.
		

Crossrefs

Cf. A018800 (an upper bound), A060386, A062584 (also an upper bound).
Cf. also A068165.

Programs

  • Haskell
    a068164 n = head (filter isPrime (digitExtensions n))
    digitExtensions n = filter (includes n) [0..]
    includes n k = listIncludes (show n) (show k)
    listIncludes [] _ = True
    listIncludes (h:_) [] = False
    listIncludes l1@(h1:t1) (h2:t2) = if (h1 == h2) then (listIncludes t1 t2) else (listIncludes l1 t2)
    isPrime 1 = False
    isPrime n = not (hasDivisorAtLeast 2 n)
    hasDivisorAtLeast k n = (k*k <= n) && (((n `rem` k) == 0) || (hasDivisorAtLeast (k+1) n))
    
  • Maple
    A068164 := proc(n)
        local p,pdigs,plen,dmas,dmasdigs,i,j;
        # test all primes ascending
        p := 2;
        while true do
            pdigs := convert(p,base,10) ;
            plen := nops(pdigs) ;
            # binary digit mask over p
            for dmas from 2^plen-1 to 0 by -1 do
                dmasdigs := convert(dmas,base,2) ;
                pdel := [] ;
                for i from 1 to nops(dmasdigs) do
                    if op(i,dmasdigs) = 1 then
                        pdel := [op(pdel),op(i,pdigs)] ;
                    end if;
                end do:
                if n = add(op(j,pdel)*10^(j-1),j=1..nops(pdel)) then
                    return p;
                end if;
            end do:
            p := nextprime(p) ;
        end do:
    end proc:
    seq(A068164(n),n=1..120) ; # R. J. Mathar, Nov 13 2014
  • Python
    from sympy import sieve
    def dmo(n, t):
        if t < n: return False
        while n and t:
            if n%10 == t%10:
                n //= 10
            t //= 10
        return n == 0
    def a(n):
        return next(p for p in sieve if dmo(n, p))
    print([a(n) for n in range(1, 77)]) # Michael S. Branicky, Jan 21 2023

Extensions

Corrected by Ray Chandler, Oct 11 2003
Haskell code and b-file added by Allan C. Wechsler, Nov 13 2014

A082058 a(n) is the smallest k such that prime(k) contains the digits of n as a substring.

Original entry on oeis.org

26, 5, 1, 2, 13, 3, 18, 4, 23, 8, 26, 5, 31, 6, 35, 36, 38, 7, 42, 8, 197, 47, 48, 9, 53, 54, 56, 31, 60, 10, 63, 11, 216, 51, 69, 71, 73, 12, 76, 34, 79, 13, 82, 14, 86, 88, 89, 15, 93, 35, 96, 36, 98, 16, 100, 102, 103, 37, 107, 17, 110, 18, 257, 38, 116
Offset: 0

Views

Author

Labos Elemer, Apr 03 2003

Keywords

Examples

			0 appears first in 26th prime (101), so a(0) = 26;
9 appears first in 8th prime (19), so a(9) = 8;
24 appears first in 53rd prime (241), so a(24) = 53.
		

Crossrefs

Programs

  • Mathematica
    tg=101; T=0*Range[tg]; k=0; subs[n_] := Block[{d = IntegerDigits[n]}, Flatten@ Table[ FromDigits@ Take[d, {i, j}], {j, Length[d]}, {i, j}]]; While[tg > 0, s = subs[Prime[++k]]; Do[ If[e <= 100 && T[[e+1]] == 0, T[[e+1]] = k; tg--], {e, s}]]; T (* Giovanni Resta, Apr 29 2017 *)

Formula

A062584(n) = prime(a(n)). - Giovanni Resta, Apr 29 2017
a(n) >= A088781(n) for n >= 1. The smallest positive n for which a(n) > A088781(n) is 114. - Pontus von Brömssen, Nov 29 2024

Extensions

Data corrected by Giovanni Resta, Apr 29 2017
Name clarified by Pontus von Brömssen, Nov 29 2024

A064735 Next prime containing prime(n) in decimal notation.

Original entry on oeis.org

23, 13, 53, 17, 113, 113, 173, 191, 223, 229, 131, 137, 241, 431, 347, 353, 359, 461, 167, 271, 173, 179, 283, 389, 197, 1013, 1031, 5107, 1091, 2113, 1277, 1319, 1373, 1399, 1493, 1151, 1571, 1163, 3167, 1733, 2179, 1181, 1913, 1193, 1973, 1993, 2111
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 17 2001

Keywords

Crossrefs

Programs

  • PARI
    a(n)={ my(q=prime(n), m=10^(logint(q,10)+1)); forprime(p=m, oo, my(x=p); while(x>=q, if(x%m==q, return(p)); x\=10)) } \\ Harry J. Smith, Sep 24 2009

Formula

a(n) = A252629(n) + prime(n). - Zak Seidov, Dec 19 2014

A086935 a(n) is the smallest square such that n occurs in its decimal representation.

Original entry on oeis.org

0, 1, 25, 36, 4, 25, 16, 576, 81, 9, 100, 1156, 121, 1369, 144, 1156, 16, 1764, 1849, 196, 2025, 121, 225, 2304, 324, 25, 2601, 2704, 289, 529, 2304, 3136, 324, 3364, 3481, 4356, 36, 3721, 3844, 3969, 400, 441, 4225, 4356, 144, 13456, 4624, 4761, 484, 49
Offset: 0

Views

Author

Zak Seidov, Sep 22 2003

Keywords

Comments

If only positive squares are considered then the first term is 100.

Examples

			a(3) = 36 since 3 occurs in 36, but not in 0, 1, 4, 9, 16, 25.
		

Crossrefs

Cf. A062584.

Programs

  • ARIBAS
    var sn,sq:string; b:boolean; end; begin for n := 0 to 49 do sn := itoa(n); c := length(sn); b := true; p := 0; while b do q := p^2; sq := itoa(q); d := length(sq); j := 0; while b and j<=d-c do if sn=sq[j..j+c-1] then b := false; write(q,","); else inc(j); end; end; if b then inc(p); end; end; end; end;

Extensions

Edited, corrected and extended by Klaus Brockhaus and Ray Chandler, Sep 22 2003

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

A060386 In base ten, we try to get the digits 0,1,2,3,...,9,0,1,2,3,... in order only using primes and each time choosing the smallest prime that will give the desired digit.

Original entry on oeis.org

101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 2, 3, 41, 5, 61, 7, 83, 19, 101
Offset: 0

Author

Labos Elemer, Apr 04 2001

Keywords

Comments

Periodic with period length 10. - N. J. A. Sloane, Nov 13 2014

Crossrefs

A065145 Smallest prime that begins with the n-th square in decimal notation.

Original entry on oeis.org

11, 41, 97, 163, 251, 367, 491, 641, 811, 1009, 1213, 1447, 1693, 19603, 2251, 25601, 2897, 32401, 3613, 4001, 44101, 48407, 5297, 57601, 6257, 6761, 7297, 7841, 8419, 9001, 9613, 10243, 10891, 115601, 12251, 12967, 13691, 14447, 15217, 16001
Offset: 1

Author

Reinhard Zumkeller, Oct 17 2001

Keywords

Crossrefs

Programs

  • Maple
    f:= proc(n) local d,m,r;
      for d from 1 do
       for m from 1 to 10^d-1 by 2 do
        r:= 10^d*n^2 + m;
        if isprime(r) then return r fi
      od od
    end proc:
    map(f, [$1..100]); # Robert Israel, May 16 2018

Formula

a(n) = A030665(n^2). - Robert Israel, May 16 2018

A080470 a(n) = smallest composite number that is obtained by placing digits anywhere in n; a(n) = n if n is composite.

Original entry on oeis.org

10, 12, 30, 4, 15, 6, 27, 8, 9, 10, 110, 12, 123, 14, 15, 16, 117, 18, 119, 20, 21, 22, 123, 24, 25, 26, 27, 28, 129, 30, 231, 32, 33, 34, 35, 36, 237, 38, 39, 40, 141, 42, 143, 44, 45, 46, 147, 48, 49, 50, 51, 52, 153, 54, 55, 56, 57, 58, 159, 60, 161, 62, 63, 64, 65, 66, 267
Offset: 1

Author

Amarnath Murthy, Mar 07 2003

Keywords

Crossrefs

Extensions

Corrected and extended by Ray Chandler, Oct 11 2003
Showing 1-10 of 23 results. Next