login
Concatenation of two or more consecutive positive integers.
12

%I #21 Dec 23 2021 07:40:23

%S 12,23,34,45,56,67,78,89,123,234,345,456,567,678,789,910,1011,1112,

%T 1213,1234,1314,1415,1516,1617,1718,1819,1920,2021,2122,2223,2324,

%U 2345,2425,2526,2627,2728,2829,2930,3031,3132,3233,3334,3435,3456,3536,3637,3738

%N Concatenation of two or more consecutive positive integers.

%H Paul Tek, <a href="/A035333/b035333.txt">Table of n, a(n) for n = 1..10000</a>

%o (Python)

%o import heapq

%o from itertools import islice

%o def agen():

%o c = 12

%o h = [(c, 1, 2)]

%o nextcount = 3

%o while True:

%o (v, s, l) = heapq.heappop(h)

%o yield v

%o if v >= c:

%o c = int(str(c) + str(nextcount))

%o heapq.heappush(h, (c, 1, nextcount))

%o nextcount += 1

%o l += 1; v = int(str(v)[len(str(s)):] + str(l)); s += 1

%o heapq.heappush(h, (v, s, l))

%o print(list(islice(agen(), 47))) # _Michael S. Branicky_, Dec 23 2021

%Y For concatenations of exactly k consecutive integers see A000027 (k=1), A127421 (k=2), A001703 (k=3), A279204 (k=4).

%Y See also A007908 for concatenation of 1 through n.

%Y For primes see A052087.

%Y All of A007908, A052087, A053067, A279610 are subsequences.

%K easy,nonn,base

%O 1,1

%A _Erich Friedman_

%E Edited by _Charles R Greathouse IV_, Apr 28 2010

%E Corrected by _Paul Tek_, Jun 08 2013