SM (HP-Prime)
·
Table of Contents
Description #
\begin{equation} T = \sum_{S=0}^{n} \end{equation}
#pragma mode( separator(.,;) integer(d64) )
EXPORT SM_U(S)
BEGIN
LOCAL T;
REPEAT
T := T + S;
S := S - 1;
UNTIL S = 0;
RETURN T;
END;
EXPORT SM_F(Start)
BEGIN
LOCAL T;
FOR S FROM Start DOWNTO 1 DO
T := T + S;
END;
RETURN T;
END;
Download SM.prime
Results #
SM_U #
S | T | G1 | macOS | Android |
---|---|---|---|---|
10 | 55 | <1s | <1s | <1s |
100 | 5'050 | <1s | <1s | <1s |
1'000 | 500'500 | <1s | <1s | <1s |
10'000 | 50'005'000 | <2s | <1s | <1s |
100'000 | 5'000'050'000 | 13s | <1s | <1s |
1'000'000 | 500'000'500'000 | — | <2s | 4s |
10'000'000 | 5.00000099494ᴇ13 | — | 11s | 41s |
SM_F #
S | T | G1 | macOS | Android |
---|---|---|---|---|
10 | 55 | <1s | <1s | <1s |
100 | 5'050 | <1s | <1s | <1s |
1'000 | 500'500 | <1s | <1s | <1s |
10'000 | 50'005'000 | 1s | <1s | <1s |
100'000 | 5'000'050'000 | 7s | <1s | <1s |
1'000'000 | 500'000'500'000 | 60s | <2s | 2s |
10'000'000 | 5.00000099494ᴇ13 | — | 6s | 20s |