login
Zero-free numbers with digit sum equal to 7.
2

%I #8 Jul 16 2021 10:06:12

%S 7,16,25,34,43,52,61,115,124,133,142,151,214,223,232,241,313,322,331,

%T 412,421,511,1114,1123,1132,1141,1213,1222,1231,1312,1321,1411,2113,

%U 2122,2131,2212,2221,2311,3112,3121,3211,4111,11113,11122,11131,11212,11221,11311,12112,12121,12211,13111,21112,21121,21211,22111,31111,111112,111121,111211,112111,121111,211111,1111111

%N Zero-free numbers with digit sum equal to 7.

%C There are exactly 64 such numbers while numbers with digit sum equal to 7 (A052221) are infinite.

%t Union[Flatten[Table[FromDigits/@Select[Tuples[Range[7],n],Total[#]==7&],{n,7}]]] (* _Harvey P. Dale_, Aug 29 2015 *)

%o (Python)

%o def ok(n): s = str(n); return '0' not in s and sum(map(int, s)) == 7

%o print(list(filter(ok, range(1111112)))) # _Michael S. Branicky_, Jul 16 2021

%Y Subsequence of A052221.

%K base,fini,full,nonn

%O 1,1

%A _Zak Seidov_, May 20 2006