Skip to content

Instantly share code, notes, and snippets.

@primus-lab
primus-lab / cardano.py
Last active December 31, 2019 07:50
Probabilistic primality test
# Author: Pedja
import random
print(" ***** CARDANO *****\n\n\n")
while True:
n=int(input("Enter a number : "))
k=int(input("Enter an accuracy parameter : "))
@primus-lab
primus-lab / fermat.py
Created October 30, 2019 08:07
Primality test for generalized Fermat numbers
'''
This script was written in python 3.x.
In order to run this script, please make sure your python version is 3.x or above.
How to run:
python fermat.py
or if it doesn't work use this one:
python3 fermat.py
Author: Pedja Terzic <pedja.terzic@hotmail.com>
'''
@primus-lab
primus-lab / T261.py
Created October 28, 2019 09:42
Primality tests for numbers of the form N=2*6^n-1 and N=2*6^n+1
'''
This script was written in python 3.x.
In order to run this script, please make sure your python version is 3.x or above.
How to run:
python T261.py
or if it doesn't work use this one:
python3 T261.py
Author: Pedja Terzic <pedja.terzic@hotmail.com>
'''
@primus-lab
primus-lab / chebyshev.py
Last active October 28, 2019 10:15
Primality test using Chebyshev polynomials of the first kind
# Authors: Peter Taylor and Pedja Terzic
import sys
print(" ***** CHEBYSHEV *****\n\n\n")
while True:
n=int(input("Enter a number : "))