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.

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