A simple prime-number bot, in python. WIP
mastodon
python
fediverse
bot
mathematics
prime-numbers

bailliePSW.py 607B

1234567891011121314151617181920212223242526272829
  1. from psimp import in_100, hund_div
  2. from lucas import LucasPrime, StrongLucasPrime
  3. from millerrabin import MillerRabin
  4. from sieve import sieval
  5. from time import process_time
  6. def BailliePSW(n):
  7. if n < 2:
  8. return False
  9. if in_100(n):
  10. return True
  11. if hund_div(n) != 0:
  12. return False
  13. if MillerRabin(n, 2):
  14. return False
  15. return StrongLucasPrime(n)
  16. def BailliePSWWeak(n):
  17. if n < 2:
  18. return False
  19. if in_100(n):
  20. return True
  21. if hund_div(n) != 0:
  22. return False
  23. if MillerRabin(n, 2):
  24. return False
  25. return LucasPrime(n)