Largest proper divisor of n: Difference between revisions
Content added Content deleted
No edit summary |
(add TI-57) |
||
Line 1,931: | Line 1,931: | ||
</pre> |
</pre> |
||
=={{header|TI-57}}== |
|||
{| class="wikitable" |
|||
! Machine code |
|||
! Comment |
|||
|- |
|||
| |
|||
Lbl 0 |
|||
1 |
|||
STO 0 |
|||
Lbl 1 |
|||
RCL 0 |
|||
SBR 9 |
|||
Pause |
|||
1 |
|||
SUM 0 |
|||
100 |
|||
x⮂t |
|||
RCL 0 |
|||
INV x≥t |
|||
GTO 1 |
|||
CLR |
|||
R/S |
|||
RST |
|||
Lbl 9 |
|||
x⮂t |
|||
1 |
|||
x⮂t |
|||
x=t |
|||
INV SBR |
|||
STO 1 |
|||
STO 2 |
|||
C.t |
|||
Lbl 8 |
|||
1 |
|||
INV SUM 2 |
|||
RCL 1 |
|||
/ |
|||
RCL 2 |
|||
- |
|||
CE |
|||
Int |
|||
= |
|||
INV x=t |
|||
GTO 8 |
|||
RCL 2 |
|||
INV SBR |
|||
| |
|||
program task() |
|||
r0 = 1 |
|||
loop |
|||
get a(r0) |
|||
display a(r0) |
|||
r0 += 1 |
|||
t = 100 |
|||
while r0 < t |
|||
end loop |
|||
clear display |
|||
end program |
|||
subroutine a(x) |
|||
t = 1 |
|||
if x = t |
|||
return x |
|||
r1 = x |
|||
r2 = x |
|||
t = 0 |
|||
loop |
|||
r2 -= 1 |
|||
get r1 |
|||
get r1/r2 |
|||
get int(r1/r2) |
|||
get mod(r1,r2) |
|||
while mod(r1,r2) <> 0 |
|||
end loop |
|||
return r2 |
|||
end subroutine |
|||
|} |
|||
=={{header|True BASIC}}== |
=={{header|True BASIC}}== |