Repository navigation
Expand file tree
/
Copy pathStatement
More file actions
106 lines (55 loc) · 3.34 KB
/
Copy pathStatement
File metadata and controls
106 lines (55 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Number Theory & Algorithms Collection: Statement of Work (SOW) ?????
The following paper presents a summary of the scope, objectives, algorithms, and technical specifications of a complete software repository under the general title "Number Theory & Algorithms Collection" to deal with properties of integers and computational number theory.
1. Overview and Project Objectives
The collection below consists of 34 self-contained Python modules and demonstrates advanced algorithmic skills with a focus on mathematical rigor, efficiency, and clarity of the code.
Primary objectives are to:
To implement a complete catalog of algorithms ranging from basic number manipulation and prime number theory through cryptography to discrete mathematics.
Ensure all solutions operate using only native Python Standard Library-math, time, sys, and random Guaranteed to have zero external dependencies.
Include performance profiling out-of-the-box by using time and sys/tracemalloc to measure execution speed and memory overhead for most of the scripts.
2. Scope of Algorithms- Complete Catalog
Core concepts and algorithms to be used in the implementation are as follows:
A. Divisibility and Digit Properties
Concept Algorithm Examples
Combinatorics
factorial(n)
Digit Manipulation
is_palindrome(n), mean_of_digits(n), digital_root(n)
is_abundant(n), is_deficient(n), aliquot_sum(n)
Special Numbers
is_harshad(n) (Niven), is_pronic(n) (Oblong), is_highly_composite (HCN)
Persistencia
multiplicative_persistence
B. Prime numbers and factorization
Concept Algorithm Examples
Factorization
prime_factors(n) (Trial Division), count_distinct_factors, count_divisors(n)
Primality Tests
is_mersenne_prime(p), is_fibonacci_prime(n)
Advanced Primes
twin_primes(limit) (Twin Prime Conjecture), is_carmichael(n) (Pseudoprimes)
Probabilistic Algorithms
miller_rabin(n) (Randomized Algo), pollards_rho(n) (Sub-exponential Factorization)
C. Modular Arithmetic and Cryptography
Concept Algorithm Examples
Cryptography
modular_exponentiation Returns (b
e
)modm)
Euclidean Algorithm
mod_inverse(a, m) (Using Extended GCD)
System of Congruences
crt(remainders, moduli) (Chinese Remainder Theorem)
Group Theory
order_mod(a, n) (Multiplicative Order)
Quadratic Reciprocity
is_quadratic_residue via Euler's Criterion
3. Implementation Highlights
Chinese Remainder Theorem (CRT)
Purpose: solve a system of congruences x=r
i
(modm
i In principle, there can never be a truly perfect crystal; all real crystals contain imperfections that play an important role in many practical applications. )
Methodology: Constructs solution x using modular inverses of partial products. This is necessary for any high-performing implementation of RSA decryption. Collatz Conjecture (The 3n+1 Problem) Algorithm If the number is even then divide by 2, if odd then multiply by 3 and add 1.
output: traces the path length-halting time for n to converge to 1. Carmichael Numbers Checks if a number 'n' is composite and for which there exists an 'a' satisfying: n−1 ≡1(modn) for all a coprime to n. Pollard's Rho Algorithm finds a non-trivial factor of a composite integer n, more rapidly than with the general trial division technique.
Approach: It involves a randomizing function as F(x)= x2. +c (mod n), and incorporates Floyd's cycle-finding logic to conclude about factors in a relatively more efficient manner.