Support Forums
Program to check if a number is prime in TIBASIC - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Life Support (https://www.supportforums.net/forumdisplay.php?fid=12)
+---- Forum: Omni's Secret Hidden Inside Tricks (https://www.supportforums.net/forumdisplay.php?fid=13)
+---- Thread: Program to check if a number is prime in TIBASIC (/showthread.php?tid=5280)



Program to check if a number is prime in TIBASIC - nevets04 - 03-14-2010

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"