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.

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.

Original entry on oeis.org

2, 2, 4, 2, 2, 373, 2, 2, 82, 2, 3
Offset: 2

Views

Author

Marco RipĂ , Aug 11 2025

Keywords

Comments

If a(13) != -1, then the corresponding prime must have more than 4178 decimal digits.
Sequence continues n=13..36: ?, 2, 2, 28, 362, 2, ?, 2, 2, 4, 2, 3, ?, 2, 5, 4, 2, 2, 37, 3, 2, 4, 2, 2.
The increasing-order analog begins 15, 2, ?. See A048436.

Examples

			a(3) = 2 since 21_(base-3) = 7_(base-10), which is prime.
		

Crossrefs

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