
The prime factors of a positive integer (or number) are the prime numbers that divide into that integer exactly, without leaving a remainder. Line 12. If X = int(X):Then - checks for that
home| Line | Command or Statement | Comments |
| 1. | prgmBPrime | |
| 2. | ClrHome | Clear Screen |
| 3. | Disp "PRIME FACTOR 0.9" | |
| 4. | Input "NUMBER=",Q | input number |
| 5. | 2->I | |
| 6. | 2->S | |
| 7. | {1}->ιFAC | ιFAC = List FAC |
| 8. | Lbl 1 | |
| 9. | √(Q)->R | √(number) |
| 10. | For(I,S,R) | For (variable,begin,end[,increment]) |
| 11. | Q/I->X | |
| 12. | If X = int(X):Then | int( (greatest integer) Note: For a given value, the result of int( is the same as the result of iPart( |
| 13. | augment(ιFAC,{I})->ιFAC | |
| 14. | Disp I | prime number |
| 15. | X->Q | new number |
| 16. | I->S | |
| 17. | Goto 1 | |
| 18. | End | |
| 19. | If I ≠ 2:I+1->I | increment I |
| 20. | End | |
| 21. | Disp Q | |
| 22. | augment(ιFAC,{Q})ιFAC | |
| 23. | Pause ιFAC | Disp all primes |
| Screenshots: | |||
![]() | ![]() | ![]() | ![]() |
| Lbl 1 | Lbl 1a | DispQ | DispQa |