Advertisement
linesguy

Mersenne prime finder in applesoft

Jan 12th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. 10 text:home:start = 1
  2. 16 if start/2 = int(start/2) then start = start + 1
  3. 20 for N = start to 9999999999 step 2
  4. 30 for P = 2 to N^0.5
  5. 40 if int(N/P) = N/P then goto 70
  6. 50 next P
  7. 60 goto 100
  8. 70 P = 2 : next N
  9. 80 end
  10.  
  11. 100 X = (2^N)-1
  12. 110 for P = 2 to X^0.5
  13. 120 if int(X/P) = X/P then goto 150
  14. 130 next P
  15. 140 print X;" (2^";N;"-1)"
  16. 150 P = 2 : Next N
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement