login
Numbers n such that Sum_of_Digits modulo n <= 2.
1

%I #6 May 06 2018 17:03:20

%S 1,2,3,4,5,6,7,8,9,10,11,20,100,101,110,200,1000,1001,1010,1100,2000,

%T 10000,10001,10010,10100,11000,20000,100000,100001,100010,100100,

%U 101000,110000,200000,1000000,1000001,1000010,1000100,1001000,1010000,1100000,2000000

%N Numbers n such that Sum_of_Digits modulo n <= 2.

%C The first 9 natural numbers, then the numbers with Sum_of_Digits <= 2. - _Stefan Steinerberger_, Feb 07 2006

%e sum(10)=1 and 1 mod 10 <= 2

%t Select[Range[10001000],Mod[Total[IntegerDigits[#]],#]<3&] (* _Harvey P. Dale_, May 06 2018 *)

%o (Perl) #!/usr/local/bin/perl -w for $i (1..1000000){ @j = split "", $i; $sum=0; for (@j){ $sum += $_; } print "$i," if ($sum % $i <=2); } __END__

%K nonn

%O 1,2

%A gamo (gamo(AT)telecable.es), Dec 23 2004

%E More terms from _Stefan Steinerberger_, Feb 07 2006

%E Corrected by _Harvey P. Dale_, May 06 2018