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.
%I A375380 #32 Aug 17 2024 12:12:39 %S A375380 1000000000,0,1,2,3,4,6,5,7,8,9,10,11,13,12,15,14,17,16,21,18,19,20, %T A375380 27,22,25,23,30,24,26,31,28,29,32,34,33,36,38,35,37,40,39,41,42,43,44, %U A375380 47,45,50,46,51,48,52,54,55,49,57,53,56,58,59,60,64,61,62,63 %N A375380 Lexicographically earliest sequence S of distinct nonnegative integers such that 9 out of the last 10 digits of S always sum to a square. %C A375380 The smallest available 10-digit integer to start S with is a(1) = 1000000000. %C A375380 The sequence is infinite as there are infinitely many integers whose 9 of the last 10 digits sum to a square. %H A375380 Michael S. Branicky, <a href="/A375380/b375380.txt">Table of n, a(n) for n = 1..10000</a> %e A375380 We start with a(1) = 1000000000: %e A375380 S = 1000000000, %e A375380 The last 10 digits of S are [1000000000]; we discard a 0 and the sum of the 9 remaining digits = 1 (a square). We try to extend S with 0: %e A375380 S = 1000000000,0, %e A375380 The last 10 digits of S are [0000000000]; we discard a 0 and the sum of the 9 remaining digits = 0 (a square). We try to extend S with 1: %e A375380 S = 1000000000,0,1, %e A375380 The last 10 digits of S are [0000000001]; we discard a 0 and the sum of the 9 remaining digits = 1 (a square). We try to extend S with 2: %e A375380 S = 1000000000,0,1,2, %e A375380 The last 10 digits of S are [0000000012]; we discard 2 and the sum of the 9 remaining digits = 1 (a square). We try to extend S with 3: %e A375380 S = 1000000000,0,1,2,3, %e A375380 The last 10 digits of S are [0000000123]; we discard 2 and the sum of the 9 remaining digits = 4 (a square). We try to extend S with 4: %e A375380 S = 1000000000,0,1,2,3,4, %e A375380 The last 10 digits of S are [0000001234]; we discard 1 and the sum of the 9 remaining digits = 9 (a square). We try to extend S with 5: %e A375380 S = 1000000000,0,1,2,3,4,5, %e A375380 The last 10 digits of S are [0000012345]; as no square can be reached, whatever we discard, we don’t extend S with 5. We try to extend S with 6: %e A375380 S = 1000000000,0,1,2,3,4,6, %e A375380 The last 10 digits of S are [0000012346]; we discard a 0 and the sum of the 9 remaining digits = 16 (a square). %e A375380 Etc. %o A375380 (Python) %o A375380 from itertools import count, islice, combinations %o A375380 def f(k, last10): %o A375380 d = list(map(int, str(k))) %o A375380 if len(d) >= 10: return d[-10:] %o A375380 else: return last10[len(d):] + d %o A375380 def c(k, last10): %o A375380 for pick9 in combinations(f(k, last10), 9): %o A375380 if sum(pick9) in {0, 1, 4, 9, 16, 25, 36, 49, 64, 81}: %o A375380 return True %o A375380 return False %o A375380 def agen(): # generator of terms %o A375380 an, seen, last10, mink = 1000000000, set(), [], 0 %o A375380 while True: %o A375380 yield an %o A375380 seen.add(an) %o A375380 last10 = f(an, last10) %o A375380 an = next(k for k in count(mink) if k not in seen and c(k, last10)) %o A375380 while mink in seen: mink += 1 %o A375380 print(list(islice(agen(), 66))) # _Michael S. Branicky_, Aug 14 2024 %Y A375380 Cf. A352000. %K A375380 base,nonn %O A375380 1,1 %A A375380 _Eric Angelini_, Aug 14 2024 %E A375380 a(14) and beyond from _Michael S. Branicky_, Aug 14 2024