login
Sum of digits = 6 times number of digits.
19

%I #20 Sep 08 2022 08:45:03

%S 6,39,48,57,66,75,84,93,189,198,279,288,297,369,378,387,396,459,468,

%T 477,486,495,549,558,567,576,585,594,639,648,657,666,675,684,693,729,

%U 738,747,756,765,774,783,792,819,828,837,846,855,864,873,882,891,909

%N Sum of digits = 6 times number of digits.

%H Harvey P. Dale, <a href="/A061423/b061423.txt">Table of n, a(n) for n = 1..1000</a>

%e 288 is a term as the arithmetic mean of the digits is (2+8+8)/3 = 6.

%p F:= proc(m,s)

%p option remember;

%p # list of all m-digit numbers with sum of digits s

%p if s > 9*m or s < 0 then return [] fi;

%p if m = 1 then return [s] fi;

%p [seq(seq(op(map(`+`,procname(j,s-i),10^(m-1)*i)),j=1..m-1),i=1..min(9,s))]

%p end proc:

%p seq(op(F(m,6*m)),m=1..3); # _Robert Israel_, Jan 27 2016

%t Select[Range[1000],Total[IntegerDigits[#]]==6*IntegerLength[#]&] (* _Harvey P. Dale_, Dec 20 2014 *)

%o (PARI) isok(n) = {digs = digits(n, 10); return(6*#digs == sum(k=1, #digs, digs[k]));} \\ _Michel Marcus_, Jul 31 2013

%o (Magma) [n: n in [1..1000] | &+Intseq(n) eq 6*#Intseq(n)]; // _Vincenzo Librandi_, Jan 28 2016

%Y Cf. A061383, A061384, A061385, A061386, A061387, A061388, A061424, A061425.

%K base,easy,nonn

%O 1,1

%A _Amarnath Murthy_, May 03 2001

%E More terms from Larry Reeves (larryr(AT)acm.org), May 16 2001