三位的水仙花数共有4个:153,370,371,407;
加一下就可以了,
153+370+371+407=1301
你可以用程序来找到他们,比如用我会的pascal语言就是:
program shuixianhuashu;
var
a,b,c:integer;
begin
for a:=1 to 9 do
for b:=0 to 9 do
for c:=0 to 9 do
if a*a*a+b*b*b+c*c*c=100*a+10*b+c then writeln(100*a+10*b+c);
end.
或:
program sxh;
var a,b,c,d:integer;
begin
for a:=100 to 999 do begin
b:=a mod 10;
c:=a mod 100 div 10;
d:=a div 100;
if b*b*b+c*c*c+d*d*d=a then writeln(a);
end;
end.
也可用C语言:
#include
int main(void)
{
int a,b,c;
for(a=1;a