login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #15 May 05 2021 18:13:15

%S 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,

%T 31,32,34,35,36,37,38,39,41,42,43,45,46,47,48,49,51,52,53,54,56,57,58,

%U 59,61,62,63,64,65,67,68,69,71,72,73,74,75,76,78,79,81,82

%N Numbers with decimal expansion (d_1, ..., d_k) such that all the sums d_i + ... + d_j with 1 <= i <= j <= k are distinct.

%C This sequence is finite, the last term being a(5562) = 8657913.

%C All positive terms are zeroless (A052382) and have distinct decimal digits (A010784).

%C There are 10, 72, 440, 1622, 2502, 906, 10, and 0 terms with 1..8 digits, resp. - _Michael S. Branicky_, May 05 2021

%H Rémy Sigrist, <a href="/A343951/b343951.txt">Table of n, a(n) for n = 1..5562</a>

%e Regarding 12458:

%e - we have the following partial sums of digits:

%e i\j| 1 2 3 4 5

%e ---+---------------

%e 1| 1 3 7 12 20

%e 2| . 2 6 11 19

%e 3| . . 4 9 17

%e 4| . . . 5 13

%e 5| . . . . 8

%e - as they are all distinct, 12458 is a term.

%o (PARI) is(n) = { my (d=digits(n), s=setbinop((i,j)->vecsum(d[i..j]), [1..#d])); #s==#d*(#d+1)/2 }

%o (Python)

%o def ok(n):

%o d, sums = str(n), set()

%o for i in range(len(d)):

%o for j in range(i, len(d)):

%o sij = sum(map(int, d[i:j+1]))

%o if sij in sums: return False

%o else: sums.add(sij)

%o return True

%o print(list(filter(ok, range(83)))) # _Michael S. Branicky_, May 05 2021

%Y Cf. A010784, A052382, A101274.

%K nonn,base,fini,full

%O 1,3

%A _Rémy Sigrist_, May 05 2021