NZMATH  1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
  Fossies Dox: NZMATH-1.2.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

nzmath.squarefree Namespace Reference

Classes

class  SquarefreeDecompositionMethod
 
class  Undetermined
 

Functions

def lenstra (n)
 
def trial_division (n)
 
def trivial_test (n)
 
def viafactor (n)
 
def lenstra_ternary (n)
 
def trivial_test_ternary (n)
 
def trial_division_ternary (n)
 

Variables

def viafactor_ternary = viafactor
 
 viadecomposition = SquarefreeDecompositionMethod().issquarefree
 

Detailed Description

Squarefreeness tests.

Definition:
  n: squarefree <=> there is no p whose square divides n.

Examples:
  - 0 is non-squarefree because any square of prime can divide 0.
  - 1 is squarefree because there is no prime dividing 1.
  - 2, 3, 5, and any other primes are squarefree.
  - 4, 8, 9, 12, 16 are non-squarefree composites.
  - 6, 10, 14, 15, 21 are squarefree composites.

Function Documentation

◆ lenstra()

def nzmath.squarefree.lenstra (   n)
If return value is True, n is squarefree.  Otherwise, the
squarefreeness is still unknown and Undetermined is raised.

The condition is so strong that it seems n is a prime or a
Carmichael number.

pre-condition: n & 1
reference: H.W.Lenstra 1973 ---

Definition at line 30 of file squarefree.py.

Referenced by nzmath.squarefree.trivial_test().

◆ lenstra_ternary()

def nzmath.squarefree.lenstra_ternary (   n)
Test the squarefreeness of n.
The return value is one of the ternary logical constants.
If return value is TRUE, n is squarefree.  Otherwise, the
squarefreeness is still unknown and UNKNOWN is returned.

The condition is so strong that it seems n is a prime or a
Carmichael number.

pre-condition: n & 1
reference: H.W.Lenstra 1973 ---

Definition at line 119 of file squarefree.py.

References nzmath.bigrange.range().

Referenced by nzmath.squarefree.trivial_test_ternary().

◆ trial_division()

def nzmath.squarefree.trial_division (   n)
Test whether n is squarefree or not.

The method is a kind of trial division.

Definition at line 50 of file squarefree.py.

References nzmath.squarefree.trivial_test().

◆ trial_division_ternary()

def nzmath.squarefree.trial_division_ternary (   n)
Test the squarefreeness of n.
The return value is one of the True or False, not None.

The method is a kind of trial division.

Definition at line 159 of file squarefree.py.

References nzmath.squarefree.trivial_test_ternary().

◆ trivial_test()

def nzmath.squarefree.trivial_test (   n)
Test whether n is squarefree or not.

This method do anything but factorization.

Definition at line 81 of file squarefree.py.

References nzmath.squarefree.lenstra().

Referenced by nzmath.squarefree.trial_division().

◆ trivial_test_ternary()

def nzmath.squarefree.trivial_test_ternary (   n)
Test the squarefreeness of n.
The return value is one of the ternary logical constants.

The method uses a series of trivial tests.

Definition at line 141 of file squarefree.py.

References nzmath.squarefree.lenstra_ternary().

Referenced by nzmath.squarefree.SquarefreeDecompositionMethod.generate(), nzmath.squarefree.SquarefreeDecompositionMethod.issquarefree(), and nzmath.squarefree.trial_division_ternary().

◆ viafactor()

def nzmath.squarefree.viafactor (   n)
Test whether n is squarefree or not.

It is obvious that if one knows the prime factorization of the number,
he/she can tell whether the number is squarefree or not.

Definition at line 98 of file squarefree.py.

Variable Documentation

◆ viadecomposition

nzmath.squarefree.viadecomposition = SquarefreeDecompositionMethod().issquarefree

Definition at line 264 of file squarefree.py.

◆ viafactor_ternary

def nzmath.squarefree.viafactor_ternary = viafactor

Definition at line 190 of file squarefree.py.