-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference.sh
More file actions
80 lines (42 loc) · 1.63 KB
/
reference.sh
File metadata and controls
80 lines (42 loc) · 1.63 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
#Bashscript lines showing applications of factor
# All functions have a variant followed by -nr that only outputs the result, this is for piping and better data handling
#Duplicating GNU factor's behaviour
factor --gnu
#Print without repeating the factor (easier to parse output)
factor --no-repeat
# or GNU style
factor --gnu-nr
# Display the maximum factor
factor --max
#Return only the maximum factor, useful
factor --max-nr
#All functions have the -nr suffix to avoid repeating the input e.g
factor --euler 17
# φ(17) : 16
factor --euler-nr 17
# 16
#List primes between 0 and N.
seq 0 N | factor --prime-filter
#Calculating unit subgroup
seq 0 N | factor --coprime-filter N
#Calculating inverses of unit subgroup
seq 0 N | factor --coprime-filter N | factor --inverse-swap N
#Determining the order of the unit group N
factor --euler N
#Determining the minimum exponent of the group N
factor --exp N
#Determining the number of solutions to a^N-1 mod N = 1
factor --fermat-liar N
# Determining the number of strong fermat liars to N
factor --strong-liar N
#Determining the ratio of strong liars to the unit subgroup, in fraction form.
factor --unit-ratio N
# Same as above but in decimal form, easier for comparison to other ratios
factor --unit-ratio-d N
# List fermat pseudoprimes to witness A.
seq 0 N | factor --fermat-filter A
# Calculate the range of ratios of the whole set, this is much more useful for sets that aren't just the integers.
# E.g p*(2p-1) or Carmichael numbers
seq 3 N | factor --unit-ratio-d-nr | sort -n | uniq
# List strong fermat pseudoprimes to witness A.
seq 0 N | factor --strong-filter A