OFFSET
1,3
COMMENTS
This sequence is finite, the last term being a(5562) = 8657913.
There are 10, 72, 440, 1622, 2502, 906, 10, and 0 terms with 1..8 digits, resp. - Michael S. Branicky, May 05 2021
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..5562
EXAMPLE
Regarding 12458:
- we have the following partial sums of digits:
i\j| 1 2 3 4 5
---+---------------
1| 1 3 7 12 20
2| . 2 6 11 19
3| . . 4 9 17
4| . . . 5 13
5| . . . . 8
- as they are all distinct, 12458 is a term.
PROG
(PARI) is(n) = { my (d=digits(n), s=setbinop((i, j)->vecsum(d[i..j]), [1..#d])); #s==#d*(#d+1)/2 }
(Python)
def ok(n):
d, sums = str(n), set()
for i in range(len(d)):
for j in range(i, len(d)):
sij = sum(map(int, d[i:j+1]))
if sij in sums: return False
else: sums.add(sij)
return True
print(list(filter(ok, range(83)))) # Michael S. Branicky, May 05 2021
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Rémy Sigrist, May 05 2021
STATUS
approved