A386985 Smallest k > 0 such that the base-n number formed by concatenating k, k - 1, ..., 2, 1 (each written in base n) is prime, or -1 if no such k exists for the given n.
2, 2, 4, 2, 2, 373, 2, 2, 82, 2, 3
Offset: 2
Examples
a(3) = 2 since 21_(base-3) = 7_(base-10), which is prime.
Links
- Mathematics Stack Exchange, Concatenation of consecutive positive integers: Does a prime also exist in base 4 (as in bases 2, 3, 5, 6, 7, 8, 9,...)?.
- Robert G. Wilson v, Letter to N. J. A. Sloane, Sep. 1992.
Programs
-
PARI
f(n, b) = my(p=1, L=1); sum(k=1, n, k*p*=L+(k==L&&!L*=b)); \\ adapted from A000422 a(n) = my(k=1); while (!ispseudoprime(f(k, n)), k++); k; \\ Michel Marcus, Aug 16 2025
Comments