login
A343951
Numbers with decimal expansion (d_1, ..., d_k) such that all the sums d_i + ... + d_j with 1 <= i <= j <= k are distinct.
1
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 31, 32, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 46, 47, 48, 49, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 64, 65, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 81, 82
OFFSET
1,3
COMMENTS
This sequence is finite, the last term being a(5562) = 8657913.
All positive terms are zeroless (A052382) and have distinct decimal digits (A010784).
There are 10, 72, 440, 1622, 2502, 906, 10, and 0 terms with 1..8 digits, resp. - Michael S. Branicky, May 05 2021
LINKS
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