cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A360391 #33 Feb 19 2023 18:43:54
%S A360391 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 A360391 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 A360391 3,3,2,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,3,3,2
%N A360391 a(n) is the number of distinct sums of nonempty subsets of the digits of n.
%C A360391 1 <= a(n) <= 2^(1 + floor(log_10(n))) - 1.
%H A360391 Michael S. Branicky, <a href="/A360391/b360391.txt">Table of n, a(n) for n = 0..10000</a>
%e A360391 k = 10: sums of digits are {0, 1, 0 + 1}, distinct sums of digits are {0, 1}, thus a(10) = 2.
%e A360391 k = 11: sums of digits are {1, 1 + 1}, distinct sums of digits are {1, 2}, thus a(11) = 2.
%e A360391 k = 12: sums of digits are {1, 2, 1 + 2}, distinct sums of digits are {1, 2, 3}, thus a(12) = 3.
%t A360391 a[n_] := Length[Union[Total /@ Select[Subsets[IntegerDigits[n]], # != {} &]]]; Array[a, 100, 0] (* _Amiram Eldar_, Feb 06 2023 *)
%o A360391 (Python)
%o A360391 from itertools import combinations as C
%o A360391 def a(n):
%o A360391     v = list(map(int, str(n)))
%o A360391     return len(set(sum(c) for r in range(1, len(v)+1) for c in C(v, r)))
%o A360391 print([a(n) for n in range(89)]) # _Michael S. Branicky_, Feb 19 2023
%Y A360391 Cf. A007953, A043562, A054054, A054055, A055642.
%K A360391 nonn,base
%O A360391 0,11
%A A360391 _Ctibor O. Zizka_, Feb 06 2023