
The prime factors of a positive integer (or number) are the prime numbers that divide into that integer exactly, without leaving a remainder.
home| Line | Command or Statement | Comments |
| 1. | prgmPrime | |
| 2. | ClrList ιA | Clear List |
| 3. | DelVar Z | |
| 4. | Input A | input number |
| 5. | Lbl A | |
| 6. | DelVar C | |
| 7. | int(1+sqrt(A->B | |
| 8. | 2->Y | |
| 9. | For(X,Y,B,1 | For (variable,begin,end[,increment]) |
| 10. | (X=2)+2->Y | |
| 11. | If A/X=int(A/X | int( (greatest integer) Note: For a given value, the result of int( is the same as the result of iPart( |
| 12. | Then | |
| 13. | X->C | |
| 14. | Goto B | |
| 15. | End | |
| 16. | If C=1 | |
| 17. | Goto C | Display |
| 18. | End | |
| 19. | If C=0 | |
| 20. | Goto C | Display |
| 21. | Lbl B | |
| 22. | A/C->A | new number |
| 23. | Z+1->Z | |
| 24. | C->ιA(Z | |
| 25. | Goto A | |
| 26. | Lbl C | Display routine |
| 27. | Z+1->Z | |
| 28. | A->ιA(Z | |
| 29. | ιA | Disp all primes |
| Screenshots: | ||||
![]() | ![]() | ![]() | ![]() | ![]() |
| Prim-1 | Prim-2 | Prim-3 | Prim-4 | Prim-5 |