Support Forums

Full Version: Program to check if a number is prime in TIBASIC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sorry, I could't get it to work for 2, 3, 5, or 7. But Honestly you should know those anyways O.o
Other than that, It works pretty well from what I've tested. This was tested on the TI-84+ Silver Edition

Code:
ClrHome
Input "Number: ",A
A/2→C
A/3→D
A/4→E
A/5→F
A/6→G
A/7→H
A/8→I
A/9→J
If iPart(C)*2=A or iPart(D)*3=A or iPart(E)*4=A or iPart(F)*5=A or iPart(G)*6=A or iPart(H)*7=A or iPart(I)*8=A or iPart(J)*9=A
Then
ClrHome
Disp "Not Prime"
Else
ClrHome
Disp "Prime"