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.

A243294 Least number k > 1 such that a number composed of k consecutive ascending digits starting with n is prime.

Original entry on oeis.org

171, 2, 179, 4, 29, 2, 5, 2, 13
Offset: 1

Views

Author

Derek Orr, Jun 02 2014

Keywords

Comments

After the digit 9 comes 0 and it repeats.
If k could equal 1, the sequence becomes {171, 1, 1, 4, 1, 2, 1, 2, 13}.
It is interesting that when n is prime, a(n) is prime.

Examples

			78 is not prime. 789 is not prime. 7890 is not prime. 78901 is prime. Thus a(7) = 5 since 78901 is a 5-digit number.
		

Crossrefs

Cf. A120821.

Programs

  • PARI
    a(n) = {s = Str(n); i = n+1; while (1, if (i==10, i = 0); s = concat(s, i); i++; if (isprime(eval(s)), return (length(s))););} \\ Michel Marcus, Jun 04 2014
  • Python
    import sympy
    from sympy import isprime
    def a(n):
        num = str(n)
        for i in range(n+1, 10**3):
            num += str(i%10)
            if isprime(int(num)):
                return len(num)
    n=1
    while n < 10:
        print(a(n), end=', ')
        n+=1