|
各桁のベキ乗和
1 ^ 3 + 5 ^ 3 + 3 ^ 3 = 153
3 ^ 3 + 7 ^ 3 + 0 ^ 3 = 370
3 ^ 3 + 7 ^ 3 + 1 ^ 3 = 371
4 ^ 3 + 0 ^ 3 + 7 ^ 3 = 407
FOR I=100 TO 10000
LET K=1
DO
LET N=I
LET S=0
LET K=K+1
DO
LET S=S+MOD(N,10)^K
LET N=INT(N/10)
LOOP UNTIL N=0 OR S>I
IF S=I THEN
LET A$=STR$(I)
FOR J=1 TO LEN(A$)-1
PRINT A$(J:J);" ^";K;" + ";
NEXT J
PRINT RIGHT$(A$,1);" ^";K;" =";I
END IF
LOOP UNTIL S>=I OR K>10
NEXT I
END
|
|