login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the number of distinct sums of nonempty subsets of the digits of n.
2

%I #33 Feb 19 2023 18:43:54

%S 1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,2,3,3,2,

%T 3,3,3,3,3,3,2,3,3,3,2,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,2,3,3,3,3,3,2,3,

%U 3,3,2,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,3,3,2

%N a(n) is the number of distinct sums of nonempty subsets of the digits of n.

%C 1 <= a(n) <= 2^(1 + floor(log_10(n))) - 1.

%H Michael S. Branicky, <a href="/A360391/b360391.txt">Table of n, a(n) for n = 0..10000</a>

%e k = 10: sums of digits are {0, 1, 0 + 1}, distinct sums of digits are {0, 1}, thus a(10) = 2.

%e k = 11: sums of digits are {1, 1 + 1}, distinct sums of digits are {1, 2}, thus a(11) = 2.

%e k = 12: sums of digits are {1, 2, 1 + 2}, distinct sums of digits are {1, 2, 3}, thus a(12) = 3.

%t a[n_] := Length[Union[Total /@ Select[Subsets[IntegerDigits[n]], # != {} &]]]; Array[a, 100, 0] (* _Amiram Eldar_, Feb 06 2023 *)

%o (Python)

%o from itertools import combinations as C

%o def a(n):

%o v = list(map(int, str(n)))

%o return len(set(sum(c) for r in range(1, len(v)+1) for c in C(v, r)))

%o print([a(n) for n in range(89)]) # _Michael S. Branicky_, Feb 19 2023

%Y Cf. A007953, A043562, A054054, A054055, A055642.

%K nonn,base

%O 0,11

%A _Ctibor O. Zizka_, Feb 06 2023