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.

This page as a plain text file.
%I A386985 #30 Aug 21 2025 08:31:57
%S A386985 2,2,4,2,2,373,2,2,82,2,3
%N 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.
%C A386985 If a(13) != -1, then the corresponding prime must have more than 4178 decimal digits.
%C A386985 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.
%C A386985 The increasing-order analog begins 15, 2, ?. See A048436.
%H A386985 Mathematics Stack Exchange, <a href="https://math.stackexchange.com/questions/5089392/concatenation-of-consecutive-positive-integers-does-a-prime-also-exist-in-base">Concatenation of consecutive positive integers: Does a prime also exist in base 4 (as in bases 2, 3, 5, 6, 7, 8, 9,...)?</a>.
%H A386985 Robert G. Wilson v, <a href="/A007088/a007088.pdf">Letter to N. J. A. Sloane, Sep. 1992</a>.
%e A386985 a(3) = 2 since 21_(base-3) = 7_(base-10), which is prime.
%o A386985 (PARI) f(n, b) = my(p=1, L=1); sum(k=1, n, k*p*=L+(k==L&&!L*=b)); \\ adapted from A000422
%o A386985 a(n) = my(k=1); while (!ispseudoprime(f(k, n)), k++); k; \\ _Michel Marcus_, Aug 16 2025
%Y A386985 Cf. A000422, A048436, A281571.
%K A386985 nonn,base,hard,more
%O A386985 2,1
%A A386985 _Marco RipĂ _, Aug 11 2025