A337707 a(n) is the lowest number in the sequence of the first occurrence of exactly n consecutive numbers with at least one repeated digit, or -1 if no such number exists.
11, 121, 99, 1898, 12898, 123898, 1234898, 12345898, 123456898, 110, 1909, 10330, 9188, 9088, 19787, 129787, 1239787, 12349787, 123459787, 1210, 12909, 103430, 1024540, 2988, 1988, 27987, 237987, 2347987, 23457987, 12310, 123909, 1034530, 10245640, 102356750, 988, 12988
Offset: 1
Examples
a(3) = 99 is the smallest number in the first appearance sequence of 3 consecutive numbers with repeated digits, 99, 100 and 101, a(15) = 19787 is the smallest number in the first appearance sequence of 15 consecutive numbers with repeated digits that starts in 19787 and finish in 19801 (19802 has no repeated digits).
Links
- Michel Marcus, Table of n, a(n) for n = 1..54
- Michel Marcus, Positions and lengths
- Michel Marcus, Lengths and positions
Crossrefs
Cf. A109303.
Programs
-
PARI
isokd(n) = my(d=digits(n)); #d != #Set(d); \\ A109303 isok(k, n) = {if (! isokd(k-1), for (i=k, k+n-1, if (! isokd(i), return (0)););! isokd(k+n););} a(n) = {my(k=1); while (!isok(k, n), k++); k;} \\ Michel Marcus, Jan 13 2022
-
PARI
lista(nn) = {my(map=Map(), r=isokd(1), nb, k, nbmax=0); for (n=2, nn, my(rr = isokd(n)); if (r, if (rr, nb++, if (! mapisdefined(map, nb), mapput(map, nb, k)); nb=0), if (rr, nb=1; k=n, nb=0); ); r = rr; ); map;} \\ Michel Marcus, Jan 14 2022
Comments