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.

A375481 Starting numbers for the terms in A035333.

This page as a plain text file.
%I A375481 #21 Aug 18 2024 20:28:49
%S A375481 1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,9,10,11,12,1,13,14,15,16,17,18,19,20,
%T A375481 21,22,23,2,24,25,26,27,28,29,30,31,32,33,34,3,35,36,37,38,39,40,41,
%U A375481 42,43,44,45,4,46,47,48,49,50,51,52,53,54,55,56,5,57,58
%N A375481 Starting numbers for the terms in A035333.
%H A375481 Michael S. Branicky, <a href="/A375481/b375481.txt">Table of n, a(n) for n = 1..10000</a>
%e A375481 a(19) = 12 since A035333(19) = 1213, the concatenation of 12 and 13.
%e A375481 a(20) =  1 since A035333(20) = 1234, the concatenation of 1, 2, 3 and 4.
%t A375481 ConsecutiveNumber[num_, numberOfNumbers_] := Module[{},
%t A375481   If[numberOfNumbers == 1, Return[num]];
%t A375481   FromDigits@(IntegerDigits[num]~Join~
%t A375481      IntegerDigits@ConsecutiveNumber[num + 1, numberOfNumbers - 1])
%t A375481  ]
%t A375481 ConsecutiveNumberDigits[maxDigits_] := Module[{numList = {}, c, d},
%t A375481   Do[
%t A375481    numList =
%t A375481      numList~Join~(Association[# -> ConsecutiveNumber[#, c]] & /@
%t A375481         Range[Power[10, d - 1], Power[10, d] - 1]);,
%t A375481    {d, 1, Floor[maxDigits/2]}, {c, 2, Floor[maxDigits/d]}
%t A375481    ];
%t A375481   SortBy[Select[numList, Values[#][[1]] < Power[10, maxDigits] &],
%t A375481    Values[#] &]
%t A375481  ]
%t A375481 Keys[ConsecutiveNumberDigits[8]]//Flatten (* number in this line corresponds to the maximum number of digits of the concatenated terms *)
%o A375481 (Python)
%o A375481 import heapq
%o A375481 from itertools import islice
%o A375481 def agen(): # generator of terms
%o A375481     c = 12
%o A375481     h = [(c, 1, 2)]
%o A375481     nextcount = 3
%o A375481     while True:
%o A375481         (v, s, l) = heapq.heappop(h)
%o A375481         yield s
%o A375481         if v >= c:
%o A375481             c = int(str(c) + str(nextcount))
%o A375481             heapq.heappush(h, (c, 1, nextcount))
%o A375481             nextcount += 1
%o A375481         l += 1; v = int(str(v)[len(str(s)):] + str(l)); s += 1
%o A375481         heapq.heappush(h, (v, s, l))
%o A375481 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Aug 18 2024
%Y A375481 For the terms generated by consecutive concatenations see A035333.For concatenations of various numbers of consecutive integers see A000027 (k=1), A127421 (k=2), A001703 (k=3), A279204 (k=4).For primes that are the concatenation of two or more consecutive integers see A052087.
%K A375481 easy,nonn,base
%O A375481 1,2
%A A375481 _Nicholas M. R. Frieler_, Aug 17 2024