Skip to content

Instantly share code, notes, and snippets.

"""
formula.py - propositional formulas for Python
by Robin Wellner
Hereby, I waive all rights to this library, as described at <http://creativecommons.org/publicdomain/zero/1.0/>
Examples:
foo = Atom('foo')
bar = Atom('bar')
disjuction = foo | bar
conjunction = foo & bar
implication = foo >> bar
@primus-lab
primus-lab / LLRT.py
Last active February 23, 2020 08:39
Conjectured primality test for numbers of the form 2kp^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 LLRT.py
or if it doesn't work use this one:
python3 LLRT.py
Author: Pedja Terzic <[email protected]>
'''
from sympy import *
@primus-lab
primus-lab / proth.py
Created January 6, 2020 08:09
Primality test for specific class of Proth numbers
# Author: Pedja
print(" ***** PROTH *****\n\n\n")
while True:
@primus-lab
primus-lab / bhaskara.py
Created January 5, 2020 18:33
Primality test
# Author: Pedja
print(" ***** BHASKARA *****\n\n\n")
while True:
@primus-lab
primus-lab / safeprime.py
Created January 5, 2020 08:08
Primality test for numbers of the form N=2*p+1
# Author: Pedja
from sympy import *
print(" ***** SAFE PRIME *****\n\n\n")
while True:
@primus-lab
primus-lab / lux.py
Created January 3, 2020 09:23
Compositeness test for numbers of the form N=k*b^n+c
# Author: Pedja
from mpmath import *
from sympy import *
print(" ***** LUX *****\n\n\n")
while True:
@primus-lab
primus-lab / sieve.py
Created January 2, 2020 08:58
Prime number sieve using LCM function
# Author: Pedja
print(" ***** SIEVE *****\n\n\n")
while True:
n1=int(input("Enter lower bound : "))
@primus-lab
primus-lab / protos.py
Last active December 31, 2019 07:47
Prime number generator.
# Author: Pedja
print(" ***** PROTOS *****\n\n\n")
while True:
n=int(input("Enter the ordinal number : "))
@primus-lab
primus-lab / cop.py
Last active December 31, 2019 07:48
Conjectured primality test
# Author: Pedja
print(" ***** COP *****\n\n\n")
while True:
n=int(input("Enter a number : "))
@primus-lab
primus-lab / mersenne.py
Last active December 31, 2019 07:49
Conjectured primality test for numbers of the form M=k*b^n-1
# Author: Pedja
from mpmath import *
print(" ***** MERSENNE *****\n\n\n")
while True:
k=int(input("Enter the coefficient : "))
b=int(input("Enter the base : "))