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

A341931 a(n) = smallest m > 0 such that the decimal concatenation n||n-1||n-2||...||m is prime, or -1 if no such prime exists.

Original entry on oeis.org

-1, -1, 2, 3, 3, 5, -1, 3, -1, -1, 7, 11, -1, 13, -1, -1, -1, 17, -1, 19, -1, -1, 19, 23, 23, 13, -1, 23, -1, 29, -1, 31, -1, -1, 33, -1, -1, 37, -1, -1, -1, 41, 41, 43, -1, -1, 3, 47, 17, -1, -1, 47, 37, 41, -1, 27, 47, -1, 57, 59, 47, 61, -1, -1, -1, -1, -1
Offset: 0

Views

Author

Chai Wah Wu, Feb 23 2021

Keywords

Comments

a(n) <= A341701(n). a(82) = 1, are there any other n such that a(n) = 1?
Primes p such that a(p) < p: 7, 53, 73, 79, 89, 103, ...
n such that a(n) < A341701(n): 7, 10, 22, 46, 48, 53, 55, 73, ...
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then a(n) is odd, n-a(n) !== 2 (mod 3) and n+a(n) !== 0 (mod 3).

Examples

			a(7) = 3 since 76543 is prime and 765432, 7654321 are not. a(10) = 7 since 10987 is prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def A341931(n):
        k, m, r = n, n-1, n if isprime(n) else -1
        while m > 0:
            k = int(str(k)+str(m))
            if isprime(k):
                r = m
            m -= 1
        return r
Showing 1-1 of 1 results.