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

A356272 a(n) is the least k such that exactly n consecutive integers starting from k belong to A124665.

Original entry on oeis.org

20, 134, 1934, 9773, 19042, 138902, 104024, 512255, 1400180, 1558490, 1441174, 9363253, 20454244, 98854550, 57515874, 201139683, 49085531, 213492618, 475478220, 1152519092
Offset: 1

Views

Author

Michel Marcus, Aug 01 2022

Keywords

Examples

			20 is in A124665, while 19 and 21 are not. This is the 1st such integer so a(1) = 20.
134 and 135 are in A124665, while 133 and 136 are not. This is the 1st such integer so a(2) = 134.
		

Crossrefs

Cf. A124665.

Programs

  • PARI
    is(n)=my(N=10*n, D=10^#Str(n)); forstep(k=n, n+9*D, D, if(isprime(k), return(0))); !(isprime(N+1)||isprime(N+3)||isprime(N+7)||isprime(N+9)); \\ A124665
    isok(k, n) = if (!is(k-1), for (i=0, n-1, if (!is(k+i), return (0));); !is(k+n););
    a(n) = my(k=2); while (!isok(k, n), k++); k;
    
  • Python
    from itertools import islice
    from sympy import isprime
    def ok(n):
        s = str(n)
        if any(isprime(int(s+c)) for c in "1379"): return False
        return not any(isprime(int(c+s)) for c in "0123456789")
    def agen():
        adict = dict()
        n = k = 1
        while True:
            c = 0
            while ok(k): k += 1; c += 1
            if c not in adict: adict[c] = k-c
            while n in adict: yield adict[n]; n += 1
            k += 1
    print(list(islice(agen(), 6))) # Michael S. Branicky, Aug 01 2022

Extensions

a(14)-a(20) from Michael S. Branicky, Aug 02 2022

A032352 Numbers k such that there is no prime between 10*k and 10*k+9.

Original entry on oeis.org

20, 32, 51, 53, 62, 84, 89, 107, 113, 114, 126, 133, 134, 135, 141, 146, 150, 164, 167, 168, 171, 176, 179, 185, 189, 192, 196, 204, 207, 210, 218, 219, 232, 236, 240, 248, 249, 251, 256, 258, 282, 294, 298, 305, 309, 314, 315, 317, 323, 324, 326, 328, 342
Offset: 1

Views

Author

Keywords

Comments

Numbers k with property that appending any single decimal digit to k does not produce a prime.
A007920(n*10) > 10.

Examples

			m=32: 321=3*107, 323=17*19, 325=5*5*13, 327=3*109, 329=7*47, therefore 32 is a term.
		

Crossrefs

Cf. A124665 (subsequence), A010051, A007811, A216292, A216293.

Programs

  • Haskell
    a032352 n = a032352_list !! (n-1)
    a032352_list = filter
       (\x -> all (== 0) $ map (a010051 . (10*x +)) [1..9]) [1..]
    -- Reinhard Zumkeller, Oct 22 2011
    
  • Magma
    [n: n in [1..350] | IsZero(#PrimesInInterval(10*n, 10*n+9))]; // Bruno Berselli, Sep 04 2012
    
  • Maple
    a:=proc(n) if map(isprime,{seq(10*n+j,j=1..9)})={false} then n else fi end: seq(a(n),n=1..350); # Emeric Deutsch, Aug 01 2005
  • Mathematica
    f[n_] := PrimePi[10n + 10] - PrimePi[10n]; Select[ Range[342], f[ # ] == 0 &] (* Robert G. Wilson v, Sep 24 2004 *)
    Select[Range[342], NextPrime[10 # ] > 10 # + 9 &] (* Maciej Ireneusz Wilczynski, Jul 18 2010 *)
    Flatten@Position[10*#+{1,3,7,9}&/@Range@4000,{?CompositeQ ..}] (* _Hans Rudolf Widmer, Jul 06 2024 *)
  • PARI
    is(n)=!isprime(10*n+1) && !isprime(10*n+3) && !isprime(10*n+7) && !isprime(10*n+9) \\ Charles R Greathouse IV, Mar 29 2013
    
  • Python
    from sympy import isprime
    def aupto(limit):
      alst = []
      for d in range(2, limit+1):
        td = [10*d + j for j in [1, 3, 7, 9]]
        if not any(isprime(t) for t in td): alst.append(d)
      return alst
    print(aupto(342)) # Michael S. Branicky, May 30 2021

Formula

a(n) ~ n. - Charles R Greathouse IV, Mar 29 2013

Extensions

More terms from Miklos Kristof, Aug 27 2002

A065502 Positive numbers divisible by 2 or 5; 1/n not purely periodic after decimal point.

Original entry on oeis.org

2, 4, 5, 6, 8, 10, 12, 14, 15, 16, 18, 20, 22, 24, 25, 26, 28, 30, 32, 34, 35, 36, 38, 40, 42, 44, 45, 46, 48, 50, 52, 54, 55, 56, 58, 60, 62, 64, 65, 66, 68, 70, 72, 74, 75, 76, 78, 80, 82, 84, 85, 86, 88, 90, 92, 94, 95, 96, 98, 100, 102, 104, 105, 106, 108, 110, 112, 114
Offset: 1

Views

Author

Len Smiley, Nov 25 2001

Keywords

Comments

Complement of A045572. - Reinhard Zumkeller, Nov 15 2009
Numbers that cannot be prefixed by a single digit to form a prime in decimal representation: A124665 is a subsequence. - Reinhard Zumkeller, Oct 22 2011
Up to 198, this is almost identical to "a(n) = n such that 3^n-1 is not squarefree", with the only exceptions being 39 and 117, which are not in this sequence. Why is that? - Felix Fröhlich, Oct 19 2014
The asymptotic density of this sequence is 3/5. - Amiram Eldar, Mar 09 2021

Crossrefs

Cf. A000035, A001622, A045572, A051628, A079998, A124665, A047229 (numbers divisible by 2 or 3).

Programs

  • Haskell
    a065502 n = a065502_list !! (n-1)
    a065502_list = filter ((> 1) . (gcd 10)) [1..]
    -- Reinhard Zumkeller, Oct 22 2011
  • Maple
    A065502 := proc(n)
         option remember;
         if n = 1 then
            2;
        else
            for a from procname(n-1)+1 do
                if (a mod 2) =0 or (a mod 5) =0 then
                    return a;
                end if;
            end do:
        end if;
    end proc; # R. J. Mathar, Jul 20 2012
  • Mathematica
    Select[Range[114], Mod[#, 2] == 0 || Mod[#, 5] == 0 &] (* T. D. Noe, Jul 13 2012 *)
    Select[ Range@ 114, MemberQ[{0, 2, 4, 5, 6, 8}, Mod[#, 10]] &] (* Robert G. Wilson v, May 22 2014 *)
  • PARI
    isok(m) = ! ((m%2) && (m%5)); \\ Michel Marcus, Mar 09 2021
    

Formula

A000035(a(n))*(1-A079998(a(n)))=0. - Reinhard Zumkeller, Nov 15 2009
G.f.: x*(2*x^4+x^2+2) / ((x-1)^2*(x^2-x+1)*(x^2+x+1)). - Colin Barker, Jul 18 2013
a(n) = 10*floor(n/6)+s(n mod 6)-floor(((n-1)mod 6)/5), where s(n) = n+1+floor((n+1)/3). - Gary Detlefs, Oct 05 2013
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2)/5 + log(phi)/sqrt(5), where phi is the golden ratio (A001622). - Amiram Eldar, Dec 28 2021

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Oct 20 2009

A124666 Numbers ending in 1, 3, 7 or 9 such that either prepending or following them by one digit doesn't produce a prime.

Original entry on oeis.org

891, 921, 1029, 1037, 1653, 1763, 1857, 2427, 2513, 2519, 2607, 3111, 3193, 3213, 3501, 3519, 3707, 3953, 4227, 4459, 4599, 4689, 4803, 4863, 5019, 5043, 5047, 5397, 5459, 5489, 5499, 6019, 6023, 6429, 6483, 6609, 6621, 7113
Offset: 1

Views

Author

Tanya Khovanova, Dec 23 2006

Keywords

Comments

If the number doesn't end in 1, 3, 7 or 9, then the prepending requirement is automatically satisfied. Hence it becomes nonrestrictive and not very interesting.

Examples

			The definition means that 891, 1891, 2891, 3891, 4891, 5891, 6891, 7891, 8891, 9891, 8911, 8913, 8917 and 8919 are all composite numbers.
		

Crossrefs

Cf. A124665.

Programs

  • Mathematica
    dppQ[n_]:=AllTrue[Join[{n},Table[m*10^IntegerLength[n]+n,{m,9}],Table[ n*10+k,{k,{1,3,7,9}}]],CompositeQ]; Select[Range[8000],MemberQ[ {1,3,7,9},Mod[ #,10]]&&dppQ[#]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 19 2018 *)
  • Python
    from sympy import isprime
    def ok(n):
        s = str(n)
        if s[-1] not in "1379": return False
        if any(isprime(int(s+c)) for c in "1379"): return False
        return not any(isprime(int(c+s)) for c in "0123456789")
    print([k for k in range(7114) if ok(k)]) # Michael S. Branicky, Aug 02 2022

A125268 Numbers that end with decimal digit 1, 3, 7, or 9 and that produce only composite numbers when any of the digits 0,1,...,9 is inserted anywhere in them (including at the beginning or end).

Original entry on oeis.org

25011, 52647, 72753, 122313, 168699, 283251, 324021, 598041, 783441, 804131, 837207, 924807, 1247241, 1905759, 2514819, 3461101, 3514077, 3617389, 3905817, 4112913, 4142139, 4203151, 4229871, 4283679, 4531907, 4628827, 4828443, 5380413, 5478091, 5632671, 5714889, 5818569, 5989269, 5990961
Offset: 1

Views

Author

I. J. Kennedy, Jan 15 2007

Keywords

Comments

Since digit 0 can be inserted at the beginning of a term, each term must be composite.

Crossrefs

Programs

  • Maple
    filter:= proc(n) local x,y,d,t;
      x:= n; y:= 0;
      for d from 0 to ilog10(n)+1 do
         for t from 0 to 9 do
           if isprime(10^(d+1)*x+10^d*t + y) then return false fi;
         od;
         t:= x mod 10;
         y:= y + 10^d*t;
         x:= (x-t)/10;
      od;
      true
    end proc:
    select(filter, [seq(seq(10*i+j,j=[1,3,7,9]),i=0..10^6)]); # Robert Israel, Sep 12 2016
  • PARI
    { printA125268(U=8) = my(v,t); v=vector(10^U); forprime(p=11,10^(U+1), if(p<=U,v[p]=p); for(i=1,#Str(p), t=(p\10^i) * 10^(i-1) + (p%10^(i-1)); if(#Str(t)==#Str(p)-1,v[t]=p););); forstep(n=1,10^U,2, if(n%10==5||v[n],next); print1(n,", ");); } \\ prints terms below 10^U, by Max Alekseyev, Sep 12 2016

Extensions

Corrected and extended by Robert G. Wilson v, Jan 26 2007
Removed incorrect terms and extended by Max Alekseyev, Sep 12 2016

A224953 Number of ways a digit can be appended or prepended to n and form a prime.

Original entry on oeis.org

4, 9, 3, 9, 3, 3, 2, 9, 2, 6, 4, 6, 1, 7, 1, 2, 2, 5, 1, 9, 0, 4, 3, 6, 1, 2, 2, 6, 2, 5, 1, 8, 0, 5, 2, 2, 1, 6, 2, 6, 2, 6, 1, 7, 2, 1, 3, 6, 1, 5, 2, 3, 2, 5, 2, 1, 2, 8, 1, 6, 2, 7, 0, 6, 3, 2, 1, 7, 1, 4, 2, 5, 1, 7, 1, 2, 2, 6, 1, 5, 1, 4, 4, 7, 0, 3, 1
Offset: 0

Views

Author

Keywords

Comments

The prime number may be formed by adding a digit either before or after n, though only odd numbers can become prime by having digits added before n.
Appending a zero before n produces a prime if and only if n is prime. Conversely, for all prime numbers p, a(p) > 0.
In theory, a maximum of 7 digits could be added before any n, and 3 of the odd digits after n in cases where [10*n, 10*n+9] contains a number that is a factor of 3, 5 and 7 (the three single-digit odd primes). In practice, it appears that all 10 possibilities are never realized. There are 9 possibilities for n = {1, 3, 7, 19}.
The only example of a prime being formed two different ways is for n = 1, which can become 11 if a 1 is appended to either the front or the back. These are naively counted as two distinct alternatives. [This would also be true for n = A002275(A004023(k) - 1) for k > 1 as appending a 1 to either the front or the back forms the k-th repunit prime. - Michael S. Branicky, May 22 2024]
The term a(29587) is the first occurrence of 10. The primes are 29587, 129587, 329587, 429587, 729587, 929587, 295871, 295873, 295877, and 295879. This is the only occurrence of 10 for n < 10^8. - T. D. Noe, Apr 21 2013

Examples

			a(0) = 4 because there are 4 ways to concatenate a digit to 0 to produce a prime number: 02, 03, 05, and 07.
a(3) = 9 because a digit can be concatenated to 3 in 9 ways to produce a prime number: 03, 13, 23, 43, 53, 73, 83, 31, and 37.
		

Crossrefs

Cf. A069686.
Cf. A075595.
Index of zeros in this sequence: A124665.

Programs

  • Mathematica
    Table[num = IntegerDigits[n]; cnt = 0; Do[If[PrimeQ[FromDigits[Prepend[num, k]]], cnt++], {k, 0, 9}]; Do[If[PrimeQ[FromDigits[Append[num, k]]], cnt++], {k, 0, 9}]; cnt, {n, 0, 86}] (* T. D. Noe, Apr 20 2013 *)
  • R
    sapply(1:100, function(x) sum(sapply(as.numeric(c(paste0(0:9,x), paste0(x,c(1,3,7,9)))), is_prime  ))) # Christian N. K. Anderson, Apr 30 2024

A356273 a(n) is the position of the least prime in the ordered set of numbers obtained by inserting/placing any digit anywhere in the digits of n (except a zero before 1st digit), or 0 if there is no prime in that set.

Original entry on oeis.org

2, 5, 1, 5, 8, 7, 1, 11, 1, 2, 1, 10, 1, 14, 7, 10, 1, 10, 1, 0, 4, 7, 4, 7, 8, 11, 1, 11, 4, 10, 1, 0, 2, 14, 11, 16, 1, 14, 1, 5, 2, 7, 8, 11, 16, 11, 3, 19, 1, 8, 1, 8, 3, 10, 17, 14, 1, 20, 3, 7, 4, 0, 1, 11, 14, 13, 1, 17, 2, 8, 2, 16, 1, 14, 13, 14, 2, 22, 1, 17
Offset: 1

Views

Author

Michel Marcus, Aug 01 2022

Keywords

Comments

It appears that a(n) = 0 for n in A124665.
891, a term of A124665 and with a(891) = 9, is the first counterexample. - Michael S. Branicky, Aug 01 2022

Examples

			For n=1, the resulting set is (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 31, 41, 51, 61, 71, 81, 91) where the least prime 11 is at position 2, so a(1) = 2.
For n=2, the resulting set is (12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 42, 52, 62, 72, 82, 92) where the least prime 23 is at position 5, so a(2) = 5.
		

Crossrefs

Related to the process in A068166, A068167, A068169, A068170, A068171, A068172, A068173, and A068174.
Cf. A124665.

Programs

  • Mathematica
    Table[Function[w, If[IntegerQ[#], #, 0] &@ FirstPosition[Rest@ Union@ Flatten@ Table[FromDigits@ Insert[w, d, k], {k, Length[w] + 1, 1, -1}, {d, 0, 9}], ?PrimeQ][[1]]][IntegerDigits[n]], {n, 80}] (* _Michael De Vlieger, Aug 01 2022 *)
  • PARI
    get(d, rd, n, k) = {if (n==0, return(fromdigits(concat(d, k)))); if (n==#d, return(fromdigits(concat(k, d)))); my(v = concat(Vec(d, #d-n), k)); v = concat(v, Vecrev(Vec(rd, n))); fromdigits(v);}
    a(n) = {my(d=digits(n), rd = Vecrev(d), list = List(), p); for (n=0, #d, my(kstart = if (n==#d, 1, 0)); for (k=kstart, 9, listput(list, get(d, rd, n, k)););); my(svec = Set(Vec(list))); for (k=1, #svec, if (isprime(svec[k]), return(k)););}
    
  • Python
    from sympy import isprime
    def a(n):
        s = str(n)
        out = set(s[:i]+c+s[i:] for i in range(len(s)+1) for c in "0123456789")
        out = sorted(int(k) for k in out if k[0] != "0")
        ptest = (i for i, k in enumerate(sorted(out), 1) if isprime(int(k)))
        return next(ptest, 0)
    print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Aug 01 2022
Showing 1-7 of 7 results.