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.

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.

Original entry on oeis.org

1000000000, 0, 1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 11, 13, 12, 15, 14, 17, 16, 21, 18, 19, 20, 27, 22, 25, 23, 30, 24, 26, 31, 28, 29, 32, 34, 33, 36, 38, 35, 37, 40, 39, 41, 42, 43, 44, 47, 45, 50, 46, 51, 48, 52, 54, 55, 49, 57, 53, 56, 58, 59, 60, 64, 61, 62, 63
Offset: 1

Views

Author

Eric Angelini, Aug 14 2024

Keywords

Comments

The smallest available 10-digit integer to start S with is a(1) = 1000000000.
The sequence is infinite as there are infinitely many integers whose 9 of the last 10 digits sum to a square.

Examples

			We start with a(1) = 1000000000:
S = 1000000000,
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:
S = 1000000000,0,
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:
S = 1000000000,0,1,
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:
S = 1000000000,0,1,2,
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:
S = 1000000000,0,1,2,3,
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:
S = 1000000000,0,1,2,3,4,
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:
S = 1000000000,0,1,2,3,4,5,
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:
S = 1000000000,0,1,2,3,4,6,
The last 10 digits of S are [0000012346]; we discard a 0 and the sum of the 9 remaining digits = 16 (a square).
Etc.
		

Crossrefs

Cf. A352000.

Programs

  • Python
    from itertools import count, islice, combinations
    def f(k, last10):
        d = list(map(int, str(k)))
        if len(d) >= 10: return d[-10:]
        else: return last10[len(d):] + d
    def c(k, last10):
        for pick9 in combinations(f(k, last10), 9):
            if sum(pick9) in {0, 1, 4, 9, 16, 25, 36, 49, 64, 81}:
                return True
        return False
    def agen(): # generator of terms
        an, seen, last10, mink = 1000000000, set(), [], 0
        while True:
            yield an
            seen.add(an)
            last10 = f(an, last10)
            an = next(k for k in count(mink) if k not in seen and c(k, last10))
            while mink in seen: mink += 1
    print(list(islice(agen(), 66))) # Michael S. Branicky, Aug 14 2024

Extensions

a(14) and beyond from Michael S. Branicky, Aug 14 2024