A115518 Numbers n such that the sum of the digits of n times the sum of the digits squared of n equals n.
1, 133, 315, 803, 1148, 1547, 2196
Offset: 1
Examples
(2 + 1 + 9 + 6)(2^2 + 1^2 + 9^2 + 6^2) = 2196.
Programs
-
Maple
p := proc (K) options operator, arrow; floor((log[10])(K))+1 end proc; A := proc (K) options operator, arrow; convert(K, base, 10) end proc; g := proc (K) options operator, arrow; sum(A(K)[i], i = 1 .. p(K)) end proc p := proc (K) options operator, arrow; floor((log[10])(K))+1 end proc; A := proc (K) options operator, arrow; convert(K, base, 10) end proc; g := proc (K) options operator, arrow; sum(A(K)[i], i = 1 .. p(K)) end proc
-
Mathematica
fQ[n_] := Block[{id = IntegerDigits@n}, Plus @@ id * Plus @@ (id^2) == n]; lst = {}; Do[ If[fQ@n, AppendTo[lst, n]], {n, 10^8}]; lst (* Robert G. Wilson v *) For[n = 1, n < 30000, n++, b = IntegerDigits[n]; If[Sum[b[[i]], {i, 1, Length[b]}]*Sum[b[[i]]^2, {i, 1, Length[b]}] == n, Print[n]]] (* Stefan Steinerberger *) Select[Range[2200],Total[IntegerDigits[#]]*Total[IntegerDigits[#]^2]==#&] (* Harvey P. Dale, Jul 10 2014 *)
Extensions
Edited by Robert G. Wilson v and Stefan Steinerberger, Jun 28 2007
Comments