login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 08:27 EDT 2024. Contains 371698 sequences. (Running on oeis4.)