
The prime factors of a positive integer (or number) are the prime numbers that divide into that integer exactly, without leaving a remainder. The "If fPart(N/A)=0" checks for this (fraction part = 0) or no remainder.
home| Line | Command or Statement | Comments |
| 1. | ClrHome | Clear Screen |
| 2. | Input "NUMBER=",N | |
| 3. | If N≤1 | Error |
| 4. | Goto 2 | Stop |
| 5. | Lbl 4 | |
| 6. | While fPart(N/2)=0 | Even Number |
| 7. | Disp 2 | |
| 8. | N/2->N | |
| 9. | Goto 4 | |
| 10. | Lbl 3 | |
| 11. | If N=1 | Last Prime |
| 12. | Goto 2 | Stop |
| 13. | For(A,3,iPart(√(N)+3),2 | N≠1 :For (variable,begin,end[,increment]) |
| 14. | If fPart(N/A)=0 | |
| 15. | Goto 1 | |
| 16. | End | |
| 17. | Disp N | |
| 18. | Goto 2 | Stop |
| 19. | Lbl 1 | |
| 20. | Disp A | |
| 21. | N/A->N | |
| 22. | If N=1 | |
| 23. | End | |
| 24. | Goto 3 | N≠1 |
| 25. | Lbl 2 | |
| 26. | Stop |