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.

A371260 a(n) is the first of three consecutive Harshad numbers in arithmetic progression.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 21, 24, 42, 110, 114, 120, 162, 192, 201, 220, 320, 330, 342, 372, 510, 511, 522, 552, 700, 774, 912, 954, 960, 1010, 1014, 1015, 1020, 1050, 1088, 1092, 1101, 1104, 1122, 1242, 1270, 1300, 1410, 1422, 1458, 1526, 1584, 1590, 1602, 1632
Offset: 1

Views

Author

John Bibby, Mar 16 2024

Keywords

Examples

			The three consecutive Harshad numbers starting at 8 (8, 9, 10) are in arithmetic progression.
The same is true of the three consecutive Harshad numbers starting at 21 (21, 24, 27).
		

Crossrefs

Cf. A005349, A122535, A154701 (subsequence).

Programs

  • Mathematica
    Select[Partition[Select[Range[2000], Divisible[#, DigitSum[#]] &], 3, 1], Equal @@ Differences[#] &][[;;, 1]] (* Amiram Eldar, Mar 17 2024 *)
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        h1, h2, h3 = 1, 2, 3
        while True:
            if h3 - h2 == h2 - h1: yield h1
            h1, h2, h3 = h2, h3, next(k for k in count(h3+1) if k%sum(map(int, str(k))) == 0)
    print(list(islice(agen(), 52))) # Michael S. Branicky, Mar 16 2024