login
Numbers that are divisible by their digital sum but not by their digital root.
1

%I #27 Mar 07 2023 10:20:28

%S 195,209,247,266,285,375,392,407,465,476,481,518,555,592,605,629,644,

%T 645,715,735,736,782,803,825,880,915,935,1066,1095,1148,1168,1183,

%U 1185,1274,1275,1365,1394,1417,1455,1526,1534,1545,1547,1635,1651,1652,1679,1725,1744,1815,1853,1886,1898,1904,1905

%N Numbers that are divisible by their digital sum but not by their digital root.

%C These are the Harshad numbers which are missing from A234474.

%H Reinhard Zumkeller, <a href="/A234814/b234814.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HarshadNumber.html">Harshad number</a>.

%e 195 is a term as it is divisible by its digital sum i.e. 15 but not by its digital root i.e. 6.

%t Select[Range@1905, Mod[#, 1 + Mod[#-1, 9]] > 0 && Mod[#, Plus@@ IntegerDigits@ #] == 0 &] (* _Giovanni Resta_, Jan 03 2014 *)

%o (C++)

%o #include<iostream.h>

%o int digitalsum(int n){int sum=0; while(n>0){sum+=n%10; n/=10;}return(sum);}

%o int digitalroot(int a){return(1+(a-1)%9);}

%o int main(){for(int i=1;i<=2000;i++){

%o if(i%(digitalroot(i))!=0 && i%(digitalsum(i))==0) cout<<i<<", ";}}

%o (Haskell)

%o a234814 n = a234814_list !! (n-1)

%o a234814_list = filter (\x -> x `mod` a007953 x == 0 &&

%o x `mod` a010888 x /= 0) [1..]

%o -- _Reinhard Zumkeller_, Mar 04 2014

%Y Cf. A005349, A234474.

%Y Cf. A064807, A007953, A010888.

%K nonn,base

%O 1,1

%A _Mihir Mathur_, Dec 31 2013