Factoring large integers

Information

  • Patent Grant
  • 12034849
  • Patent Number
    12,034,849
  • Date Filed
    Friday, September 2, 2022
    2 years ago
  • Date Issued
    Tuesday, July 9, 2024
    5 months ago
Abstract
A method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N_0=r×s, where N_0, r and s are integers. There is the step of obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory. There is the step of storing the electromagnetic signal W in a second non-transient memory. There is the step of decoding with a second computer in communication with the second non-transient memory the electromagnetic signal W in the second non-transient memory by factoring the public key N_0 in at most a time O(log^6 N_0). A non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W.
Description
FIELD OF THE INVENTION

The present invention is related to solving an equation in two or more unknown integer variables, where each variable is represented by a multiplicity of powers of multiples of an odd prime p. Specifically, the present invention is related to factoring an integer N0, restating the problem into the factorization of an appropriate integer N which is a quadratic residue modulo p, then factoring N.


BACKGROUND

The problem of resolving a large integer into the product of its prime factors has stimulated the intellectual curiosity and the imagination of many generations of mathematicians.


In 1801 Gauss wrote: “. . . the dignity of the science itself seems to require that every possible means be explored for the solution of a problem so elegant and so celebrated.” See page 397 of [3].


The problem has attracted renewed interest, ever since R. L. Rivest, A. Shamir, and L. Adleman proposed an encryption method which is based on the computational difficulty of the factorization problem [4].


This note introduces a method and apparatus which lead to the factorization of a large odd integer N0.


SUMMARY

The present invention pertains to a method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers. The method comprises the steps of obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory. There is the step of storing the signal W in a second non-transient memory. There is the step of decoding with a second computer in communication with the second non -transient memory the signal W in the second non-transient memory by factoring the public key N0 in at most a time O(log6N0) with the second computer generated steps of selecting integers a, b. There is the step of electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0]. There is the step of applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3]. There is the step of determining that [X0: X1: X2: X3]=[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is









Z
0



1

6


X
0
4



X
2
4




(

mod



N
0


)












Z
1




X
0
4




X
2
2

(


4


X
3
2


-

1

6


b
2



X
0
2


a

-

3

2


b
2



X
0



X
1



)




(

mod



N
0


)










Z
2




-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

36


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

54


X
0



X
1
5


a

-







36


X
0
2



X
1
2



X
2
2


a

+

27


X
1
6


-

36


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)




(

mod



N
0


)









Z
3





(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2




(

mod



N
0


)






Otherwise, the point [Z0, Z1, Z2, Z3] is:









Z
0





(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2



Y
0
2




(

mod



N
0


)










Z
1




X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


b
2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)




(

mod



N
0


)









Z
2




X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



b
2



X
0



X
2



Y
0
2


+

4


b
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+







3


X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-






2

a


(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)




(

mod



N
0


)









Z
3





(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








X
0
2



X
1



Y
0



Y
1
2



X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2





(

mod



N
0


)

.






There is the step of testing if any component of the third point shares a factor with N0 and is a shared factor with N0. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


The present invention pertains to a second computer for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s. The second computer comprises an input for obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory, a second non-transient memory in communication with the input in which the signal W is stored. The second computer comprises a cpu in communication with the second non-transient memory with the signal W in the second non-transient memory that decodes the signal W by factoring the public key N0 in time O(log6N0) by the second computer generated steps of selecting integers a, b. There is the step of electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0]. There is the step of applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3]. There is the step of determining that [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is









Z
0



1

6


X
0
4



X
2
4




(

mod



N
0


)












Z
1




X
0
4




X
2
2

(


4


X
3
2


-

1

6


b
2



X
0
2


a

-

3

2


b
2



X
0



X
1



)




(

mod



N
0


)










Z
2




-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

36


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

54


X
0



X
1
5


a

-







36


X
0
2



X
1
2



X
2
2


a

+

27


X
1
6


-

36


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)




(

mod



N
0


)









Z
3





(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2




(

mod



N
0


)






Otherwise, the point [Z0, Z1, Z2, Z3] is:









Z
0





(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2



Y
0
2




(

mod



N
0


)










Z
1




X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


b
2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)




(

mod



N
0


)









Z
2




X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



b
2



X
0



X
2



Y
0
2


+

4


b
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+







3


X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-






2

a


(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)




(

mod



N
0


)









Z
3





(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








X
0
2



X
1



Y
0



Y
1
2



X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2





(

mod



N
0


)

.






There is the step of testing if any component of the third point shares a factor with N0 and is a shared factor with N0. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. The cpu decrypting the signal W with the public key N0 and prime factors of integer N0. The cpu reviewing the decrypted signal W for predetermined words to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be quickly acted upon to eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


The present invention pertains to a non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s, where the signal W has been stored in a second non-transient memory of a second computer, and the second computer factoring the public key N0 in time O(log6N0). The signal W obtained from a telecommunications network, or a data network or an Internet or a first non-transient memory. The computer program having the second computer generated steps of selecting integers a, b. There is the step of electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0]. There is the step of applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3]. There is the step of determining that [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is









Z
0



1

6


X
0
4



X
2
4




(

mod



N
0


)












Z
1




X
0
4




X
2
2

(


4


X
3
2


-

1

6


b
2



X
0
2


a

-

3

2


b
2



X
0



X
1



)




(

mod



N
0


)










Z
2




-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

36


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

54


X
0



X
1
5


a

-







36


X
0
2



X
1
2



X
2
2


a

+

27


X
1
6


-

36


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)




(

mod



N
0


)









Z
3





(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2




(

mod



N
0


)






Otherwise, the point [Z0, Z1, Z2, Z3] is:









Z
0





(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2



Y
0
2




(

mod



N
0


)










Z
1




X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


b
2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)




(

mod



N
0


)









Z
2




X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



b
2



X
0



X
2



Y
0
2


+

4


b
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+







3


X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-






2

a


(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)




(

mod



N
0


)









Z
3





(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








X
0
2



X
1



Y
0



Y
1
2



X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2





(

mod



N
0


)

.






There is the step of testing if any component of the third point shares a factor with N0 and is a shared factor with N0. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


The present invention pertains to a method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers. The method comprises the steps of obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory. There is the step of storing the signal W in a second non-transient memory. There is the step of decoding with a second computer in communication with the second non-transient memory the signal W in the second non-transient memory by factoring the public key N0 in at most a time O(log6N0) with the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There is the step of determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There is the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pki and truncating all terms xm for m≥M. There is the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p. There is the step of determining a shared factor that integers r(p) and s(p) share with N0, where the shared factor with N0 as one of plurality of prime factors of N0. There is the step of obtaining another prime factor by division of N0 by the shared factor. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


The present invention pertains to a second computer for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s. The second computer comprises an input for obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory. The second computer comprises a second non-transient memory in communication with the input in which the signal W is stored. The second computer comprises a cpu in communication with the second non -transient memory with the signal W in the second non-transient memory. The cpu decodes the signal W by factoring the public key N0 in time O(log6N0) by the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There is the step of determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There is the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pkt and truncating all terms xm for m≥M. There is the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p. There is the step of determining a shared factor that integers r(p) and s(p) share with N0, where the shared factor with N0 as one of plurality of prime factors of N0. There is the step of obtaining another prime factor by division of N0 by the shared factor. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. The cpu decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. The cpu reviewing the decrypted signal W for predetermined words to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


The present invention pertains to a non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s, where the signal W has been stored in a second non-transient memory of a second computer, and the second computer factoring the public key N0 in time O(log6N0). The signal W obtained from a telecommunications network, or a data network or an Internet or a first non-transient memory. The computer program having the second computer generated steps of: selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There is the step of determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There is the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pkt and truncating all terms xm for m≥M. There is the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p. There is the step of determining a shared factor that integers r(p) and s(p) share with N0, where the shared factor with N0 as one of plurality of prime factors of N0. There is the step of obtaining another prime factor by division of N0 by the shared factor. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.





BRIEF DESCRIPTION OF THE FIGURE


FIG. 1 is a block diagram regarding the claimed invention.



FIG. 2. is a flow chart of the factorization process regarding the claimed invention.



FIG. 3 is a flow chart for obtaining a public/private key pair regarding the claimed invention.



FIG. 4 is a flow chart for decoding, decrypting, and scanning electromagnetic signal W regarding the claimed invention.





THE PROBLEM

Given a positive odd integer N0, it is desired to determine a pair of integers r0 and s0 such that

N0=r0·s0.  (1)


The problem can also be stated as the search for two integers Y0and X0such that Y0>X0 and

N0=Y02−X02.  (2)


The pairs (r0, s0) and (Y0, X0) are related as follows:









{






Y
0

=



r
0

+

s
0


2








X
0

=



r
0

-

s
0


2





.





(
3
)







Conversely,









{






r
0

=


Y
0

+

X
0









s
0

=


Y
0

-

X
0






.





(
4
)







If r0>s0>0, both Y0 and X0 are positive. In this case it is useful to consider some limit cases in order to develop an appreciation for the magnitude of the variables.


One of the limit cases occurs when the pair (r0, s0) is a pair of “twin primes”, such as (43, 41). In these cases,









{






X
0

=
1







Y
0

=



N
0

+
1






.





(
5
)







At the other end is the case when r0 approximates N0. At the limit, consider a pair (r0, s0) equaling (N0, 1). Then









{






X
0

=



N
0

-
1

2








Y
0

=



N
0

+
1

2





.





(
6
)







Therefore, in all cases









{





X
0
2

<

Y
0
2







1


X
0
2

<


(



N
0

-
1

2

)

2









N
0

+
1



Y
0
2

<


(



N
0

+
1

2

)

2









(
7
)







Thus, in all cases, Y02>N0. In some cases, X02 is greater than N0.


A Restatement

Given N0 and an odd prime p, the general solution of (1) has the following form:









{






r
0

=

α
+


λ
0

·
p









s
0

=

β
+


μ
0

·
p






.





(
8
)








where α, β, λ0, and μ0 denote integers and where α·β≡N0 (mod p). If α and β are both even or both odd, λ0 and μ0 have the same parity. Otherwise, define β′=β+p and μ′00−1. Thus, without loss of generality, it is possible to define two integers U0 and V0 as follows:









{






U
0

=



λ
0

-

μ
0


2








V
0

=



λ
0

+

μ
0


2





.





(
9
)








Then









{






r
0

=

α
+


U
0

·
p

+


V
0

·
p









s
0

=

β
-


U
0

·
p

+


V
0

·
p






.





(
10
)







The integers V0 and U0 are usually referred to as the symmetric and antisyrnmetric components of the pair (r0, s0), respectively. In general, in the search for (U0, V0), all values of α in the interval 1≤α<p may need to be tested.


The complexity of the problem is reduced in the cases when









{




α


β

(

mod


p

)








α
·
β





N
0

(

mod



p
2


)

.









(
11
)







In such cases V0≡0 (mod p).


In order to realize this situation, it is possible to restate the problem of factoring N0 into the problem of factoring some integer N which satisfies (11). To this end, select a prime p, and let n0 be the unique integer with pn0−1<N0<pn0. Select a candidate value of α, say {tilde over (α)}. Then define τ by the following:

N0≡τ·{tilde over (α)}2 (mod p2).  (12)


Let {tilde over (τ)} denote the least positive residue of (12). Then β≡{tilde over (τ)}·{tilde over (α)} (mod p). If {tilde over (τ)} is odd, define the integer N by the following

N={tilde over (τ)}·N0  (13)

where, for some integer n, pn−1<N<pn. Then N is a quadratic residue modulo p and

N≡{tilde over (τ)}2·{tilde over (α)}2 (mod p).  (14)


Note that now there is a factorization N=r·s, with r≡s (mod p), namely r={tilde over (τ)}r0 and s=s0. There exist unique integers U and V such that









{




r
=



τ
~

·

α
~


+

U
·
p

+

V
·

p
2










s
=



τ
~

·

α
~


-

U
·
p

+

V
·

p
2




,








(
15
)








where









{




r
=


τ
~

·

r
0








s
=

s
0









(
16
)







Notice that, if U>0, r>s.


In the case of (15), it will be









{




Y
=



τ
~

·

α
~


+

V
·

p
2









X
=

U
·

p
.










(
17
)







Also, since {tilde over (τ)} is odd,









{





Y
=




τ
~

·

r
0


+

s
0


2







X
=




τ
~

·

r
0


-

s
0


2





.





(
18
)







The factorization problem requires the identification of a pair (Ũ, {tilde over (V)}) such that, for the corresponding ({tilde over (r)}, {tilde over (s)}), it is

N={tilde over (r)}·{tilde over (s)}.  (19)


In general, all the values of α should be tested.


Consider the expression of Y when à is used in lieu of {tilde over (τ)}·{tilde over (α)}:












Y
=




τ
~

·

α
~


+

V
·

p
2









=



A
~

+


V
1

·

p
2










(
20
)








for some integer V1. Recall that, by (7),

√{square root over (N)}<Y<N.  (21)


There are two significant particular cases: if Ã<√{square root over (N)}, then V1>0. Also, if Ã>N, then V1<0. Throughout this presentation, Ã will be greater than N. For simplicity of notation, the integer V will be constrained to be positive. Then (15) takes the following form:









{






A
~

>
N






r
=


A
~

+

U
·
p

-

V
·

p
2









s
=


A
~

-

U
·
p

-

V
·

p
2







.





(
22
)







A particular definition of N can be produced when τ is computed modulo pn0. In this presentation, without loss of generality, it will be assumed that {tilde over (τ)} is a positive odd integer, and so N={tilde over (τ)}N0 is an odd quadratic residue modulo p.


A Note on the Representation of N

Given pn−1<N<pn, where N is a quadratic residue modulo p, let










N
=




i
=
0


n
-
1





v
i

·

p
i




,




(
23
)








where {vi} denote integers, and 0≤vi<p.


It is desired to compute a solution of the following:

N≡A2 (mod pn)  (24)

where










A





i
=
0


n
-
1




a
i

·


p
i

(

mod



p
n


)




,




(
25
)








and where

0≤αi<p.  (26)


Subject to (26), the solution of (24) is provided by the following:









{






v
0




a
0
2




(

mod


p

)









v
1




2
·

a
0

·

a
1


+




a
0
2

-

v
0


p



(

mod


p

)










v
2




2
·

a
0

·

a
1


+

a
1
2

+




RH
1

-

LH
1


p




(

mod


p

)















v
i







k
=
0

i




a
k

·

a

i
-
k




+




RH

t
-
1


-

LH

t
-
1



p




(

mod


p

)















v

n
-
1








k
=
0


n
-
1





a
k

·

a

n
-
k




+




RH

n
-
2


-

LH

n
-
2



p



(

mod


p

)







,





(
27
)








where RHi and LHi denote the RHS and LHS, respectively, of the congruence containing vi.


The terms (RHi−LHi)/p are usually referred to as carries. They are caused by the constraint (26) and flow from the less significant digits to the more significant ones. As an example, consider the problem of solving

N≡A2 (mod p5),  (28)

where N is a quadratic residue modulo p. Assume p=13 and












N
=





i
=
0

4




v
i

·

p
i









=


10
+

2
·
p

+

10
·

p
2


+

5
·

p
3


+

0
·

p
4









=

12711.







(
29
)







If 0≤αi<p, a solution of (28), say Ã, can be represented as follows:

Ã=6+0·p+3·p2+10·p3+5·p4.  (30)


A second solution of (28) occurs when {tilde over (α)}0=6 is replaced by α0=p−{tilde over (α)}0=7. In this case

Ā=7+12·p+9·p2+2·p3+7·p4.  (31)


Consider removing the magnitude constraints (26) from all αi and representing A as

A≡ω01·p+ω2·p23·p34·p4 (mod p5),  (32)

where the coefficients of any power of p are positive integers and are constrained by the following conditions:

0≤ωi<pn−i.  (33)


Then the congruence (28) can be satisfied if the sum of the coefficients of any power of p, say pi, is congruent to zero modulo p5−i. Specifically, in the example, it must be









{





v
0





ω
0
2




(

mod



p
5


)










v
1

·
p





2
·

ω
0

·

ω
1

·
p




(

mod



p
5


)










v
2

·

p
2







ω
1
2

·

P
2


+


2
·

ω
0

·

ω
2

·

p
2





(

mod



p
5


)











v
3

·

p
3






2
·

ω
1

·

ω
2

·

p
3


+


2
·

ω
0

·

ω
3

·

p

3







(

mod



p
5


)











v
4

·

p
4







ω
2
2

·

p
4


+

2
·

ω
1

·

ω
3

·

p
4


+


2
·

ω
0

·

ω
4





(

mod



p
5


)











(
34
)







In the example, consider the condition

10≡ω02 (mod p5)  (35)


For ω0≡6 (mod p) , the least positive solution, say {tilde over (ω)}0, is {tilde over (ω)}0=181200. For {tilde over (ω)}0≡p−6≡7 (mod p), it is ω0=190043. To satisfy the second of (34) when {tilde over (ω)}0=181200, it must be

p≡2·{tilde over (ω)}0·ω1·p (mod p5).  (36)


The least positive solution, say {tilde over (ω)}1, is {tilde over (ω)}1=18120.


Thereafter, from the third of (34), let

10·p2≡({tilde over (ω)}12+2·{tilde over (ω)}0·{tilde over (ω)}2p2 (mod p5),  (37)

whence {tilde over (ω)}2=1814. Likewise, from the fourth of (34), let

p3≡2·{tilde over (ω)}1·{tilde over (ω)}2·p3+2·ω0·ω3·p3 (mod p5),  (38)

whence {tilde over (ω)}3=97. Finally, from the fifth of (34), let

p4≡ω22·p4+2ω1·ω3p4+2ω0·p4 (mod p5),  (39)

whence {tilde over (ω)}4=12. Then

N≡(181200+18120·p+1814·p2+97·p3+12·p4)2 (mod p5)  (40)


Proceeding in a similar fashion with ω0=190093, it is

N≡(190093+10441·p+383·p2+72·p3+1·p4)2 (mod p5)  (41)


Comparison of the resulting {tilde over (ω)}i with the corresponding ωi yields









{






ω
i

+


ω
_

i


=

p

5
-
i








0
<

ω
i

<

p

5
-
i










(
42
)








or

i+ωipi=p5.  (43)


Thus, in the example,












181200
+
190093




=

p
5







18120
+
10441




=

p
4







1814
+
383





=

p
3







97
+
72




=

p
2







12
+
1




=
p







(
44
)








and

Ã+Ā=5·p5.  (45)


Notice that, when à and Ā are subject to the constraint (26), as in (40) and (31), their sum equals 5p5.


Comparing the representations of à of (40) and (30), it can be stated that the representation proposed by (40) entails an equipartition of weight among the 5 degrees of freedom of (32).


Remark 1. In the example, each coefficient {tilde over (ω)}i of à is computed modulo p5−i. If the magnitude constraint (26) were to be applied to the coefficients on the RHS of (40) and (41), the coefficients ωi would be reduced modulo p and the structure (34) would be demolished.


In practice, the integer N, as represented on the RHS of (40) and (41), should be treated as a polynomial in some integer variable u, say P(u), where P(u) happens to be computed at u=p.


Remark 2. In (32) the representation of the coefficients ωi i is arbitrary. In (40) and (41) such coefficients are represented in base 10. They may be represented in any other base, such as p.


Remark 3. It should be noted that in (28) p4<N<p5 and in (32) A is being defined modulo p5. In general, such may not be the case. It is possible that A be defined modulo a larger power of p, depending on the requirements of the problem on hand. A similar situation occurs in the domain of irrational numbers, such as √{square root over (2)}. √{square root over (2)} may be computed with a large number of decimal digits, depending on the precision required by the problem on hand. No harm is done if the precision of the computed value of √{square root over (2)} is greater than needed.


As an example, consider the case when p=13 and N1<p2. Assume that N1=v0+v1·p=10+2·p. It is desired to solve

N1≡A2 (mod p5).  (46)


In this case the integers ωi are defined by the following:









{





v
0




ω
0
2





(

mod



p
s


)








v
1

·
p




2
·

ω
0

·

ω
1

·
P





(

mod



p
5


)






0





ω
1
2

·

p
2


+

2
·

ω
0

·

ω
z

·

p
2







(

mod



p
5


)






0




2
·

ω
1

·

ω
2

·

p
3


+

2
·

ω
0

·

ω
3

·

p
3







(

mod



p
5


)






0




2
·

ω
1

·

ω
3

·

p
4


+

2
·

ω
0

·

ω
4

·

p
4


+


ω
2
2

·

p
4







(

mod



p
5


)








(
47
)







For ω0=6 (mod p), the result is













N
1


=


10
+

2
·
p













(


1

8

1

2

0

0

+

18120
·
p

+

1291
·

p
2


+

23
·

p
3


+

2
·

p
4



)

2





(

mod



p
5


)

.









(
48
)







Compare with (40).


Remark 4. As a further application of this method of representation of integers, consider the problem of computing Ã−1 (mod p5) when à is defined as in (32). Let

Ā−1≡w0+w1·p+w2·p2+w3·p3+w4·p4 (mod p5)  (49)

and

÷Ã−1≡1 (mod p5)  (50)


The coefficients wi should be defined as the least positive solutions of the following:









{






ω
~

0

·

w
0







1



(

mod



p
5


)











ω
˜

0

·

w
1


+



ω
˜

1

·


w
˜

0








1



(

mod



p
4


)











ω
˜

0

·

w
2


+



ω
˜

1

·


w
˜

1


+



ω
˜

2

·


w
˜

0








0



(

mod



p
3


)











ω
˜

0

·

w
3


+



ω
˜

1

·


w
˜

2


+



ω
˜

2

·


w
˜

1


+



ω
˜

3

·


w
~

0








0



(

mod



p
2


)













ω
˜

0

·

w
4


+



ω
˜

1

·


w
˜

3


+



ω
˜

2

·


w
˜

2


+



ω
˜

3

·


w
˜

1


+



ω
˜

4

·


w
˜

0









0



(

mod


p

)










(
51
)







In the example, Ã−1≡18120+26749·p+1590·p2+73·p3+9·p4 (mod p5). The product ÷Ã−1 also contains the following terms:









{





(



ω
1

·

w
4


+


ω
2

·

w
3


+


ω
3

·

w
2


+


ω
4

·

w
1



)

·

p
5





=

3


47391
·

p
5










(



ω
2

·


w
˜

4


+



ω
˜

3

·


w
~

3


+



ω
˜

4

·


w
~

z



)

·

p
6





=

15478
·

p
6









(




ω
˜

3

·


w
˜

4


+



ω
˜

4

·


w
˜

3



)

·

p
7





=

353
·

p
7










ω
˜

4

·


w
~

4

·

P
8





=

18
·


p
8

.










(
52
)







Supercongruences

This section summarizes the approach of U.S. Pat. No. 10,298,393 B1. This is generalized and improved upon via standard polynomials later.


Given p and N, select à as one of the solutions of (24) modulo pn, computed using the procedure described in Section 7. Assume Ã>pn.


Then, using (26), let

N=Ã2U2·p2−2·Ã·V·p2+V2·p4,  (53)

where









{





A
~

=




i
=
0


n
-
1






ω
~

i

·

p
i









U
=




i
=
1


n
-
1





u
i

·

p

i
-
1










V
=




i
=
1


n
-
1





v
i

·

p

i
-
2












(
54
)







Referring to (40), recall that each ωi can be represented as










ω
i

=




k
=
0


n
-
1
-
i




ω

i
,
k


·


p
k

.







(
55
)







Also,









{





u
i


=





k
=
1


n
-
1
-
i




u

i
,
k


·

p

k
-
1











v
i


=





k
=
1


n
-
1
-
i




v

i
,
k


·

p

k
-
2












(
56
)








and









{




U

i
,
j





=






k
=
1


j



u

i
,
j


·

p

k
-
1










V

i
,
j





=





k
=
1

j



v

i
,
k


·

p

k
-
2












(
57
)








Then









{




r



A
~

+


u
1

·
p

+


(


-

v
2


+

u
2


)

·

p
2


+


(


-

v
3


+

u
3


)

·

p
3


+

+


(


-

v

n
-
1



+

u

n
-
1



)

·


p

n
-
1



(

mod




p


n


)









s



A
~

-


u
1

·
p

+


(


-

v
2


-

u
2


)

·

p
2


+


(


-

v
3


-

u
3


)

·

p
3


+

+


(


-

v

n
-
1



-

u

n
-
1



)

·


p

n
-
1



(

mod



p
n


)











(
58
)







The representation (58) of r and s accounts for the fact that both r and s are smaller than pn. However, using (58), the product of r by s contains powers of p greater than pn, actually as high as p2·n−2.


In order to uncover the properties which relate the coefficients of (58), it is necessary to compute, and represent without loss of information, the multiples of any pi which results from the multiplication of r and s. To this end a new modulus is introduced, namely pM, where M>n. The use of M does not affect the magnitude of N. If N<pn, it can be represented as follows:









{




N
=




i
=
0


n
-
1




v
i

·

p
i










v
i

=



0


for


n

-
1

<
i


M
-
1










(
59
)







When M is employed in lieu of n, Ã should be computed as a solution of the following:

N≡A2 (mod pM).  (60)


The Approach

In the case where (59) is employed, reduction of (58) modulo p3 yields












N
-

Ã
2



p
M


·


p
M






(


-

u
1
2


-

2
·

Ã
·


v
2



)

·



p
2


(

mod



p
3


)

.






(
61
)







Then, if the pair (ũ1, {tilde over (v)}2) is a solution of (61) modulo p, it is













N
-

Ã
2



p
M


·

p
M


+



(





u
~

1
2

+

2
·

A
~

·


v
~

2



p

·
p

)

·

p
2







(



-
2

·


u
~

1

·

u
2


-

2
·

A
~

·


v
3



)

·


p
3


(

mod



p
4


)






(
62
)







The LHS of this congruence contains a contribution to the set of multiples of p3. This contribution is usually denoted as a “carry”. The flow of carries from one digit to the higher powers of p increases the complexity of the factorization problem. The flow of carries would be controlled better if (61) were solved modulo pM and the pair (u12, v2) were defined modulo pM−2. In this case (62) could take the following form:













N
-


A
~

2



p
M


·

p
M


+


(





u
~

1
2

+

2
·

A
~

·


v
~

2




p

M
-
2



·

p

M
-
2



)

·

p
2






(



-
2

·


u
~

1

·

u
2


-

2
·

A
~

·

v
3



)

·


p
3

(

mod



p
4


)






(
63
)







This approach would require replacing the magnitude constraints (25) from the elements of {ui} and {vi} and assuring that the RHS of congruences such as (63) include all the terms which are multiples of any given pi. Following this procedure, still there would be carries, as shown on the LHS of (63). However, such carries would flow from any given congruence directly into a pool of multiples of pM.


In this approach, quantities such as Ã2−N are treated as polynomials in p, where the coefficients are integers unconstrained by (26) but instead subject to a different constraint such as (33).


Consider the representation of the pair (r, s) as in (58), where à is constructed as described above, and M is used in lieu of n. Thus, when r is multiplied by s, it is possible to group all the terms which contain any multiple of any given power of p, say pi, and place the condition that the sum of their coefficients be congruent to zero modulo pM−i.


However, resolving the integer Ã2−N into its components, the sum of the coefficients of pi in (Ã2−N) equals

















k
=
0

i




ω
˜

k

·


ω
˜


i
-
k




-

v
i




 

0



(

mod


p

M
-
i



)








=




η
˜

i

·


p

M
-
i


.









(
64
)








(ni an integer).


As a result, consider the case when it is desired to express v6 as a function of all the ul (1≤l≤5) and the vj (2≤j≤5). It will be

−(2·{tilde over (ω)}0·v6+2·{tilde over (ω)}1·v5+2·{tilde over (ω)}2·v4+2·{tilde over (ω)}3·v3+2·{tilde over (ω)}4·v2)+2·v2·v4+v32≡2·u1·u5+2·u2·u4+u32 (mod pM−6).  (65)


This congruence defines v6 modulo pM−6 as a function of lesser degree variables. If u1≢0 (mod p) and if all variables of lesser degree are known, (65) defines a linear congruence between v6 and u5 modulo pM−6. After determination of v6, upon multiplication by p6, it will be












(




L


H
6


-

R


H
6




p

M
-
6



·

p

M
-
6



)

·

p
6




0



(

mod



p
M


)



,




(
66
)







where LH6 and RH6 denote the LHS and RHS of (65), respectively. The LHS of this latter congruence is a multiple of pM and does not contain any power of p greater than pM. In general, for 2≤i≤M−1,









{





u
1



0



(

mod


p

)








2

i


M
-
1










-
2

·




k
=
2

i




ω
˜


i
-
k


·

v
κ




+




κ
=
2


i
-
2




v
k

·

v

i
-
k











/
𝔠

=
1


i
-
1




u
k

·



u

i
-
k



(

mod



p

M
-
i



)


.











(
67
)







The first summation on the LHS of (67) contains terms which result from the multiplication of −2·Ã by (Ã−Y), when à is represented as described in Section 7. The second summation on the LHS results from (Ã−Y)2.


In general, assume that uM−j=0 for 1≤j≤j0. Therefore, at this point, j0 is an undetermined integer. The pair (r, s) is dependent on the set {ui} and on the first elements of {vi}, for 2≤i≤j0+1. The general expression of (r, s) is









{




r
=



ω
˜

0

+



ω
˜

1

·
p

+



u
~

1

·
p

+




i
=
2


j
0





ζ
~

·

p
i



+


ζ


j
0

+
1


·

p


j
0

+
1



+

2
·




i
=
2


j
0







u
~

i

·

p
i

·
2






i
=


j
0

+
1



M
-

j
0

-
1





u
i

·

p
i













s
=



ω
˜

0

+



ω
~

1

·
p

-



u
~

1

·
p

+




i
=
2


j
0





ζ
˜

i

·

p

t
˙




+


ζ


j
0

+
1


·

p


j
0

+
1












(
68
)








where

ζk={tilde over (ω)}k−vk−uk.  (69)


Supercongruence for u1 and u2

To determine the first two coefficients of U, impose the condition that uM−1=0 and

ωi−ui−vi≡0 (mod pM−i)

for all i>2, also put ζ22−u2−v2. Then


Consider the case when it has been assumed that uM−1=0. It is desired to determine a pair of divisors (r, s) when uM−2≠0, if such a pair exists. In this case (68) can be written as follows:









{





u

M
-
1


=



0





r
=






A
~

2

+


u
1

·
p

+


(


-

v
2


+

u
2


)

·

p
2








s
=






A
2

~

-


u
1

·
p

+


(


-

v
2


+

u
2


)

·

p
2


-

2
·




i
=
3


M
-
2





u
i

·

p
i












(
70
)








where

Ã2={tilde over (ω)}0+{tilde over (ω)}1·p+{tilde over (ω)}2·p2  (71)

and









{





u

M
-
1


=
0






r
=



A
~

1

+


u
1

·
p

+


ζ
2

·

p
2


+

2
·




i
=
2


M
-
2





u
i

·

p
i











s
=



A
~

1

-


u
1

·
p

+


ζ
2

·

p
2











(
72
)








where

Ã1={tilde over (ω)}0+{tilde over (ω)}1·p  (73)

and where ζ2 is defined as in (69):









{





u

M
-
1


=
0







u

M
-
2



0







ζ
2

=


ω
2

-

v
2

-


u
2

.










(
74
)







Compare with (68) and (69).


Using (72), multiply r by s modulo pM. Setting the sum of the coefficients of any given power of p congruent to zero (mod pM−i) yields









{





v
0





ω
~

0
2

(

mod



p
M


)








v
1



2
·


ω
~

0

·



ω
~

1

(

mod



p

M
-
1



)









v
2




-

u
1
2


+


ω
~

1
2

+

2
·


ω
~

0

·

ζ
2


+

2
·


ω
~

0

·


u
2

(

mod



p

M
-
2



)










v
3




2
·


ω
~

0

·

u
3


+

2
·

(



ω
~

1

-

u
1


)

·

u
2


+

2
·


ω
~

1

·


ζ
2

(

mod



p

M
-
3



)










v
4




2
·


ω
~

0

·

u
4


+

2
·

(



ω
~

1

-

u
1


)

·

u
3


+

2
·

ζ
2

·

u
2


+


ζ
2
2

(

mod



p

M
-
4



)









for


i

>
4







v
i




2
·


ω
~

0

·

u
2


+

2
·

(



ω
~

i

-

u
i


)

·

u

i
-
1



+

2
·

ζ
2

·


u

i
-
2


(

mod



p

M
-
i



)






































v

M
-
2





2
·


ω
~

0

·

u

M
-
2



+

2
·

(



ω
~

1

-

u
1


)

·

u

M
-
3



+

2
·

ζ
2

·


u

M
-
4


(

mod



p
2


)










v

M
-
1





2
·

(



ω
~

1

-

u
1


)

·

u

M
-
2



+

2
·

ζ
2

·


u

M
-
3


(

mod


p

)











(
75
)







Let RHi and LHi denote the RHS and the LHS, respectively, of that congruence in (75) which is defined modulo pM−i. Then, it must be

RHi−LHi≡0 (mod pM−i)  (76)


Define










C
i

=



RH
i

-

LH
i



p

M
-
i







(
77
)







There is one condition which is not contained in (75): that is the condition that the sum of all multiples of pM in the system be equal to zero:









0
=




i
=
0


M
-
1





C
i

.






(
78
)







Refer to (72).


In this equation the integer uM−2 is defined modulo p2 by the second last congruence of (75). Also in the computation of CM−1, the integers uM−2 and uM−3 equal the corresponding values in the second last congruence of (75). The set of congruences (75) shall be referred as a supercongruence.


Supercongruence for u3

Consider the case when, given M, the system (75) has produced a set of viable pairs (u1, u2). In general, the majority of such pairs do not satisfy the conditions on the carries and cannot be considered as viable candidates.


Given a selection of u1, upon multiplication of r by s, the following relationships are applicable:










u

M
-
1


=

0







v
0





ω
0
2

(

mod



p
M


)








v
1




2
·

ω
0

·


ω
1

(

mod



p

M
-
1



)









v
2





2
·

ω
0

·

ω
2


+

ω
1
2

-

u
1
2

-

2
·

ω
0

·


v
2

(

mod



p

M
-
2



)













ω
1
2

-

u
1
2

+

2
·

ω
0

·

ζ
2


+

2
·

ω
0

·



u
2

(

mod



p

M
-
2



)

.










Given u1, this congruence produces v2 modulo pM−2. The last congruence makes use of the definition

ζ2≡{tilde over (ω)}2−v2−u2 (mod pM−2).


Given a selection of u2,










v
3





2
·

ω
0

·

ω
3


+

2
·

ω
1

·

ω
2


-

2
·

u
1

·

u
2


-

2
·

ω
1

·

v
2


-

2
·

ω
0

·


v
3

(

mod



p

M
-
3



)













2
·


ω
˜

0

·

u
3


+

2
·

(



ω
˜

1

-

u
1


)

·

u
2


+

2
·


ω
˜

1

·

ζ
2


+

2
·


ω
˜

0

·


ζ
3

(

mod



p

M
-
3



)










Given u2, this congruence produces v3 modulo pM−3. The last congruence makes use of the definition

ζ3≡{tilde over (ω)}3−v3−u3 (mod pM−3).


Given a selection of the auxiliary variable u3, let

v4≡2·ω0·ω4+2·ω1·ω322−2·u1·u3−u22−2·ω2·v2−2·ω1·v3+v22−2·ω0·v4 (mod pM−4)


Given u3, this congruence produces v4 modulo pM−4.


Multiplication of r by s produces

v5≡2·ω0·u5+2·(ω1−u1u4+2·ζ2·u3+2·ζ3·u2+2·ζ2·ζ3 (mod pM−5)
v6≡2·ω0·u6+2·(ω1−u1u5+2·ζ2·u4+2·ζ3·u332 (mod pM−6)


For i>6, it will be

v7≡2·ω0·u7+2·(ω1−u1u6+2·ζ2·u5+2·ζ3·u4 (mod pM−7)
vi≡2·ω0·ui+2·(ω1−u1ui−1+2·ζ2·ui−2+2·ζ3·ui−3 (mod pM−i)

with, finally:

vM−3≡2·ω0·uM−3+2·(ω1−u1uM−4+2·ζ2·uM−5+2·ζ3·uM−6 (mod p3)
vM−2≡2·(ω1−u1uM−3+2·ζ2·uM−4+2·ζ3·uM−5 (mod p2)
vM−1≡2·ζ2·uM−3+2·ζ3·uM−4 (mod p)


IN SUMMARY, given (ui, u2) and the selection of u3, IF the pair (r, s) is represented as follows:









{





u

M
-
1


=
0







u

M
-
2


=
0






r
=



A
~

1

+



u
~

1

·
p

+



ζ
~

2

·

p
2


+


ζ
3

·

p
3


+

2
·


u
~

2

·

p
2


+

2
·




i
=
2


M
-
4





u
i

·

p
i












s
=



A
~

1

+



u
~

1

·
p

+



ζ
~

2

·

p
2


+


ζ
3

·


p
3

(

mod


p

)




,








(
79
)








multiplication of r by s modulo pM yields:









{





u

M
-
2


=
0







u

M
-
1


=
0







v
0





ω
~

0
2

(

mod



p
M


)








v
1



2
·


ω
~

0

·



ω
~

1

(

mod



p

M
-
1



)









v
2





ω
~

1
2

-

u
1
2

+

2
·


ω
~

0

·

ζ
2


+

2
·


ω
~

0

·


u
2

(

mod



p

M
-
2



)










v
3




2
·


ω
~

0

·

u
3


+

2
·

(



ω
~

1

-

u
1


)

·

u
2


+

2
·



ω
~

.

1

·

ζ
2


+

2
·


ω
~

0

·


ζ
3

(

mod



p

M
-
3



)










v
4




2
·

ω
0

·

u
4


+

2
·

(


ω
1

-

u
1


)

·

u
3


+

2
·

ζ
2

·

u
2


+


2
·


ω
~

1




ζ
3


+


ζ
2
2

(

mod



p

M
-
4



)









v
5




2
·

ω
0

·

u
5


+

2
·

(


ω
1

-

u
1


)

·

u
4


+

2
·

ζ
2

·

u
3


+

2
·

ζ
3

·

u
2


+

2
·

ζ
2

·


ζ
3

(

mod



p

M
-
5



)










v
6




2
·

ω
0

·

u
6


+

2
·

(


ω
1

-

u
1


)

·

u
5


+

2
·

ζ
2

·

u
4


+

2
·

ζ
3

·

u
3


+


ζ
3
2

(

mod



p

M
-
6



)









for


i

>
6







v
i




2
·

ω
0

·

u
i


+

2
·

(


ω
1

-

u
1


)

·

u

i
-
1



+

2
·

ζ
2

·

u

i
-
2



+

2
·

ζ
3

·


u

i
-
3


(

mod



p

M
-
i



)


















































v

M
-
3





2
·

ω
0

·

u

M
-
3



+

2
·

(


ω
1

-

u
1


)

·

u

M
-
4



+

2
·

ζ
2

·

u

M
-
5



+

2
·

ζ
3

·


u

M
-
6


(

mod



p
3


)










v

M
-
2





2
·

(


ω
1

-

u
1


)

·

u

M
-
3



+

2
·

ζ
2

·

u

M
-
4



+

2
·

ζ
3

·


u

M
-
5


(

mod



p
2


)










v

M
-
1





2
·

ζ
2

·

u

M
-
3



+

2
·

ζ
3

·

u

M
-
4












(
80
)







For each initial selection of the pair (u1, u2), the system (80) may produce a quintuple (u1, u2, u3, ζ2, ζ3) such that r·s≡N (mod pM).


Supercongruence for u4

After the determination of the roster of candidates quintuples (ũ1, ũ2, ũ3, {tilde over (ζ)}2, {tilde over (ζ)}3), a similar procedure can be used to determine the roster {(u4, ζ4)}.


In this case, (68) yields:









{





v
0





ω
~

0
2

(

mod



p
M


)








v
1



2
·


ω
~

0

·



ω
~

1

(

mod



p

M
-
1



)









v
2




-


u
~

1
2


+


ω
~

1
2

+

2
·


ω
~

0

·

ζ
2


+

2
·


ω
~

0

·



u
~

2

(

mod



p

M
-
2



)










v
3




2
·


ω
~

0

·

u
3


+

2
·

(



ω
~

1

-


u
~

1


)

·


u
~

2


+

2
·


ω
~

1

·


ζ
^

2


+

2
·


ω
~

0

·



ζ
~

3

(

mod



p

M
-
3



)










v
4




2
·


ω
~

1

·


ζ
~

3


+

2
·

(



ω
~

1

-


u
~

1


)

·


u
~

3


+

2
·


ω
~

0

·

(



ω
~

4

-

v

4
,
1



)


+


ζ
~

2
2

+

2
·


u
~

2

·



ζ
~

2
2

(

mod



p


M
-
4

)













v
5




2
·

(



ω
~

1

-


u
~

1


)

·

u
4


+

2
·


ω
~

0

·

u
5


+

2
·


ω
~

1

·


ζ
~

4


+




k
=
2

3





ζ
~

k

·


ζ
~


5
-
k




+

2
·




k
=
2

3




u
~


5
-
k


·



ζ
~

k

(

mod



p

M
-
5



)












For






6


h

8







v
h




2
·

(



ω
~

1

-


u
~

1


)

·

u

h
-
1



+

2
·


ω
~

0

·

u
h


+




k
=

h
-
4


4





ζ
~

k

·


ζ
~


h
-
k




+

2
·




k
=
2

3





u
~


h
-
k


·


ζ
~

k




+

2
·

u

h
-
4


·


ζ
4

(

mod



p

M
-
h



)










For


6


h


M
-
4








v
h




2
·

(



ω
~

1

-


u
~

1


)

·

u

h
-
1



+

2
·


ω
~

0

·

u
h


+

2
·




k
=
2

3





u
~


h
-
k


·


ζ
~

k




+

2
·

u

h
-
4


·


ζ
4

(

mod



p


M
-
h

)














(
81
)







To determine u4 (mod p), consider the raster of candidate triads (ũ1, ũ2, ũ3) which were already produced. Substitute ũ1, ũ2, and ũ3 into (81) in lieu of u1, u2, and u3, respectively, and search for an integer u4 modulo p which satisfies (81).


The General Supercongruence, Persistent Solutions

Consider the case when a candidate set (ũ1, {tilde over (ζ)}2, . . . , {tilde over (ζ)}j0, ζj0|M) has been determined. It is desired to determine a candidate set (ũ1, {tilde over (ζ)}2, . . . , {tilde over (ζ)}j0, ζj0+1|M), if such a set exists.


Notice that in (68) the unknown variables are ζj0+1 and the integers ui, or j0+1≤i≤M−j0−1.


Proceeding as in (75) and (80), multiply r by s modulo pM and define the corresponding congruences modulo pM−i. The congruences which are defined modulo pM−2 through pM−j0 are not affected by ζj0+1·pj0+1).


The congruence modulo pM−j0−1 does not contain uj0+1. After the computation of uj0+1,1, the system of congruences allows one to determine the whole set {ui}.


In general, multiplication of r by s modulo pM using (68) yields









{





v


j
0

+
1





2
·


ω
~

0

·

ζ


j
0

+
1



+

2
·


ω
~

1

·


ζ
~


j
0



+




k
=
2



j
0

-
1






ζ
~

k

·


ζ
~



j
0

+
1
-
k




+

2
·


ω
~

0

·


u
~



j
0

+
1



+

2
·

(



ω
~

1

-


u
~

1


)

·


u
~


j
0



+

2
·




k
=
2



j
0

-
1






u
~



j
0

+
1
-
k


·



ζ
~

k

(

mod



p

M
-

j
0

-
1



)












v


j
0

+
2





2
·


ω
~

1

·

ζ


j
0

+
1



+




k
=
2



j
0

-
1






ζ
~



j
0

+
2
-
k


·


ζ
~

k



+

2
·


ω
~

0

·


u
~



j
0

+
2



+

2
·

(



ω
~

1

-


u
~

1


)

·


u
~



j
0

+
1



+

2
·




k
=
2


j
0






u
~



j
0

+
2
-
k


·



ζ
~

k

(

mod



p

M
-

j
0

-
2



)












For






3


δ



j
0

+
2








v


j
0

+
δ


=





k
=

δ
-
1




j
0

+
1





ζ
~



j
0

+
δ
-
k


·


ζ
~

k



+

2
·


ω
~

0

·

u


j
0

+
δ



+

2
·

(



ω
~

1

-


u
~

1


)

·

u


j
0

+
δ
-
1



+

2
·




k
=
2



j
0

+
1





u


j
0

+
δ
-
k


·



ζ
~

k

(

mod



p

M
-

j
0

-
δ



)













For







j
0


+
4


δ


n
-
1
-

j
0









v


j
0

+
δ





2
·


ω
~

0

·

u


j
o

+
δ



+

2
·

(



ω
~

1

-


u
~

1


)

·

u


j
0

+
δ
-
1



+

2
·




k
=
2



j
0

+
1





u


j
0

+
δ
-
k


·




ζ
~

k

(

mod



p

M
-

j
0

-
δ



)

.













(
82
)







Note that uj0=0 for n−2−j0≤δ≤M−1−j0.


A set of coefficients (ũ1, ũ2, . . . , ũM−1) and ({tilde over (v)}2, {tilde over (v)}3, . . . , {tilde over (v)}M−1) is called a persistent solution if the first j0+1 of the ui satisfy the corresponding supercongruence (82).


Standard Polynomials

The supercongruences can be clarified with the use of polynomials. The approach here shall be slightly more general than that taken previously.


This section shall make use of vectors of non-negative integers k=[k0, . . . , kM−1]. If k and k′ are two such vectors, then write k≤k′ if ki≤k′i for i=0, . . . , M−1. It is also occasionally convenient to regard k and k′ as zero-padded on the right, so that the comparison k≤k′ becomes meaningful even if k and k′ have different lengths.


A vector k=[k0, . . . , kM−1] is called monotone decreasing if k0≥k1≥ . . . ≥kM−1.


Definition 1. Let p be prime, M be a positive integer, and k=[k0, . . . , kM−1] be a vector of non-negative integers. A polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1.


Definition 2. Let p, k be as in Definition 1. Let f(x)=f0+f1x+ . . . +fnxn be a polynomial with integer coefficients. The pk-standard part of f(x) is the polynomial

SPpkf(x)=f0+f1x+ . . . +fnxn

where, for 0≤i<M,

fi=fi mod pki.


Note that if f is pk-standard, then it is pk′-standard for all k′≥k. When p and k are understood, SPpk may be abbreviated as SP.


Definition 3. If f and g are integer polynomials, then

f≡g (SPpk)

shall mean that

SPpkf=SPpkg.


Digit expansions of positive integers:


Suppose the integer N is prepared as above, and N=v0+v1p+ . . . +vn−1pn−1 is the p-adic digit expansion of N. Then

v(x)=v0+v1x+ . . . +vn−1xn−1

is p1n-standard where 1n=[1, 1, . . . , 1] (n times).


Theorem 1. Given a non-negative integer N, there exists a unique 1n-standard polynomial v(x) such that v(p)=N.


The following recursive algorithm produces the coefficients of the polynomial v(x).

    • If N=0, then v(x)=0.
    • Otherwise, let N1, a0 be the quotient and remainder of N on division by p, respectively. Then let v(x)=α0+xv1 (x) where v1(x) is the polynomial obtained from applying this algorithm to N1.


This algorithm terminates after [1+logpN] steps, and it is clear by induction that N=v(p). For uniqueness, if v and it are two standard polynomials such that v(p)=μ(p), say v(x)=a0+xv1(x) and μ(x)=b0+xμ1 (x), then v(p)≡μ(p) (mod p) implies that a0≡b0(mod p) and therefore a0=b0 since both are non-negative integers less than p. It then follows that v1(p)=μ1(p), which now implies uniqueness by induction on the degree.


Properties of the standard part


Proposition 1. f+g≡SPpkf+SPpkg (SPpk) and, if k is monotone decreasing, then f·g≡SPpkf·SPpkg (SPpk)


The following proposition motivates a choice of standard polynomials relevant to the supercongruences:


Proposition 2. Suppose that k=[M, M−1, . . . , 1]. If

f(x)≡g(x) (SPpk),

then

f(p)≡g(p) (mod pM).


In particular, this implies that if standard polynomials A, U, V are chosen such that

v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SPpk),

then the difference

(A(p)−U(p)−V(p))(A(p)−U(p)+V(p))−v(p)

is a multiple of pM, and represents the accumulated carry of the product, which for the purposes of factorization is desired to be zero. The advantage of this approach is that it allows the carry to be deferred to the final stage of the process.


Standard Polynomial Inversion

Theorem 2. Let p be prime and k a nonempty vector of positive exponents. Suppose that f(x) is a pk-standard polynomial such that f(0)≢0 (mod p). Then there exists a unique pk-standard polynomial g(x) such that f(x)g(x)≢1 (SPpk).


Proof The theorem shall be established by first giving its iterative solution. Since f(0)≢0 (mod p), there exists an integer γ0 such that γ0f(0)≡1 (mod p). Let g0(x)=γ0 and, for j=0,1, . . . , define

gj+1(x)=SP((2−f(x)gj(x))gj(x)).


The iteration reaches a fixed point within ┌log2max(k0, k1+1, . . . , kM−1+M−1)┌ iterations. Indeed, define a norm on the set of integer polynomials via

|f|p=inf{p−r−s|r, sϵcustom character, f≡O(xr) (mod p5)}.


Then, it shall be shown below that

|1−fgj+1|p≤|1−fgj|p2.  (83)


The constant term of 1−fg0 is zero mod p: i.e., |1−fg0|<p−1. Consequently it follows by repeated squaring that |1−fgj|≤p−2j for all j. Thus as soon as 2j>max(k0, k1+1, . . . , kM−1+M−1), the standard part of 1−fgj is zero and gj is the standard polynomial inverse to f.


It remains to compute 1−fgj+1:










1
-

fg

j
+
1



=


1
-


f

(

2
-

fg
j


)



g
j









=



(

1
-

fg
j


)

-


(

1
-

fg
j


)



g
j









=



(

1
-

fg
j


)

2









whence (83) by multiplicativity of the norm. □


Standard Polynomial Square Root

Theorem 3. Let p be an odd prime and k a nonempty vector of positive exponents. If v(x) is an integer polynomial such that v(0)≡α2 (mod p), then there exists a unique standard polynomial A(x) such that:

A2(x)≡v(x) (SPpk),

and

A(0)≡α (mod p).


(This theorem implies in particular that, given {tilde over (ω)}0, there is a unique sequence {tilde over (ω)}1, {tilde over (ω)}2, . . . , {tilde over (ω)}M−1 such that (64) holds.)


Proof. By assumption, v(0) is a quadratic residue. Let α2≡v(0) (mod p). Define A0(x)=αand, for k=0,1, . . . , define

Ak+1(x)=2−1(Ak(x)+v(x)Ak(x)−1) (SP)

where at each stage of the iteration, the inverses are computed as in the previous section.


Consider the difference










v
-

A

j
+
1

2





v
-


1
4



A
j
2


-


1
2


v

-


1
4



v
2



A
j

-
2










=




1
2



(

v
-

A
j
2


)


+


1
4



(


A
j
2

-


v
2


A
j
2



)









=




1
2



(

v
-

A
j
2


)


+


1
2




A

j
+
1



A
j




(


A
j

-

v

A
j



)









=



1
2



(

v
-

A
j
2


)




(

1
-


A

j
+
1



A
j



)

.









Next, note that








1
-


A

j
+
1



A
j



=


1
2



(


v
-

A
j
2



A
j


)



.




Substituting into the above gives







v
-

A

j
+
1

2


=


1
4




(

v
-

A
j
2


)

2



A
j

-
1







and therefore, by multiplicativity of the norm from the proof of Theorem 2,

|v−Aj+12|p≤|v−Aj2|p2.


Hence,

Aj2≡v (SP)

as soon as 2j>max(k0, k1+1, . . . , kM−1+M−1).□


Standard Polynomial Factorization

Let N be an integer prepared as in the previous section, and let v(x) be the polynomial obtained from the p-adic digit expansion of N Let A(x) be a standard polynomial such that

A2(x)≡v(x) (SPpk).


Definition 4. A standard polynomial factorization of v(x) is a pair of standard polynomials U(x), V(x) such that U(0)=V(0)=V′(0)=0 for which:

    • the standard part of the polynomial

      (A(x)+U(x)−V(x))(A(x)−U(x)−V(x))

      is equal to v(x).


That is:

(A(x)+U(x)−V(x))(A(x)−U(x)−V(x))≡v(x) (SPpk).  (84)


The condition U(0)=0 shall be abbreviated U(x)=O(x), and the pair of conditions V(0)=V′(0)=0 shall be abbreviated V(x)=O(x2). Note polynomial factorization in the usual sense will not work: v(x) is very unlikely to factor completely, even if N is guaranteed to have factors. For example, with N=15, p=11, v(x)=2+91x+6x2 is irreducible, even though N=v(11)=15 has factors 3×5.


U(x) determines V(x) uniquely:


Theorem 4. Suppose A(x) is a standard polynomial such that A(x)2≡v(x) (SPpk). Let U(x) be a standard polynomial satisfying U(x)=O(x), Then there exists a unique standard polynomial V(x) satisfying V(x)=O(x2) such that (A(x)+U(x)−V(x))(A(x)−U(x)−V(x))≡v(x) (SPpk)


Proof. Rearranging

(A+U−V)(A−U−V)−v=0

as a quadratic equation in V gives:

V2−2AV+(A2−U2−v)=0.


Let Δ(x)=U2(x)+v(x) be the quarter discriminant of the quadratic. Since U(0)=0 and v(0) is a quadratic residue modulo p, Δ(0) is also a quadratic residue modulo p, having square root ω0 mod p. Therefore by Theorem 3, there exists a unique standard polynomial √{square root over (Δ)}(x) with the property that √{square root over (Δ)}(0)≡ω0 (mod p) and

√{square root over (Δ)}(x)2≡Δ(x) (SP)


Note that

√{square root over (Δ)}(x)=A(x)+O(x2)


Therefore

V(x)=A(x)−√{square root over (Δ)}(x) (SPpk)

satisfies V(x)=O(x2).


For uniqueness, notice that the other candidate solution to the quadratic is

A(x)+√{square root over (Δ)}(x)≡2A(x)+O(x2) (SPpk)

has nonzero lower order terms in x. □


Different Forms of Standard Polynomial Factorization
Definition 5. Given a Factorization





v(x)≡(A(x)+U(x)−V(x))(A(x)−U(x)−V(x)) (SPpk)

where U(0)=V(0)=V′(0)=0, define a polynomial ζ(x) by

ζ(x)=A(2)(x)−U(2)(x)−V(x),

where A(2)(x) and U(2)(x) are the quadratic Taylor remainders of A(x) and U(x):

A(2)(x)=A(x)−A1(x), U(2)(x)=U(x)−U1(x)

where A1 and U1 denote the linearizations of A an U, respectively:

A1(x)=A(0)+A′(0)x01x
U1(x)=U′(0)x=u1x.


Plugging the definition of ζ(x) into the standard factorization problem

(A(x)+U(x)−V(x))(A(x)−U(x)−V(x))≡v(x) (SPpk).

gives

(A1(x)−U1(x)+2U(x)+ζ(x))(A1(x)−U1(x)+ζ(x))≡v(x) (SP)  (85)


That is,

r(x)s(x)≡v(x) (SP)

where









{






r

(
x
)

=



A
1

(
x
)

-


U
1

(
x
)

+

2


U

(
x
)


+

ζ

(
x
)



)







s

(
x
)

=



A
1

(
x
)

-


U
1

(
x
)

+

ζ

(
x
)










(
86
)







Persistent factorizations


Definition 6. A k-Standard Polynomial Factorization





v(x)≡r(x)s(x) (SPpk)

is called persistent if, for all k′≥k, there exist k′-standard polynomials r′(x) and s′(x) having the same degree as r(x) and s(x), respectively, such that

r′(x)≡r(x) (SPpk)
s′(x)≡s(x) (SPpk)
v(x)≡r′(x)s′(x) (SPpk′).


Persistent factorizations as lifts of factorizations mod p:


The following theorem allows polynomials U(x) and ζ(x) modulo p to be determined from a factorization modulo p of v(x). A standard polynomial factorization may then be obtained by applying a lift.


Theorem 5. Suppose that v(x)≡a(x)b(x) (mod p) where a, b are polynomials mod p, and a(0)≡b(0)≡ω0 (mod p). Then the polynomials

A1(x)=ω01x
ζ(x)=b(x)−b(0)−b′(0)x mod p
U(x)=(a(x)−b(x))/2 mod p

satisfy

A1(x)−u1x+2U(x)+ζ(x)=a(x)
A1(x)−u1x+ζ(x)=b(x),

where u1=U′(0). That is,

(A1(x)−u1x+2U(x)+ζ(x))(A1(x)−u1x+ζ(x))≡v(x) (mod p).


Proof. Write a(x)=ω0+a1x+a2x2+ . . . , b(x)=ω0+b1x+b2x2+ . . . Then since a(x)b(x)≡v(x)≡ω02+2ω0ω1x+O(x2) (mod p),


it follows that

1=a1+b1

and so u1=(a1−b1)/2=ω1−b1 Now,












A
1

(
x
)

-


u
1


x

+

ζ

(
x
)


=



ω
0

+


ω
1


x

-


(


ω
1

-

b
1


)


x

+

ζ

(
x
)








=



ω
0

+


b
1


x

+

ζ

(
x
)








=



b

(
x
)

.








Also, since 2U(x)=a(x)−b(x),












A
1

(
x
)

-


u
1


x

+

2


U

(
x
)


+

ζ

(
x
)


=



ω
0

+


1
/
2



(


α
1

+

b
1


)


x

-


1
/
2



(


a
1

-

b
1


)


x

+

a

(
x
)

-

b

(
x
)

+

ζ

(
x
)








=



ω
0

+


b
1


x

+

a

(
x
)

-


b

(
x
)



ζ

(
x
)









=


a

(
x
)









as claimed.□


Carry Phase

The final phase is concerned with an equation of the form

A2=T·N+correction

where the correction is a multiple of pM. That is

A2=T·N+k·pM

expresses A2 as the sum of a main term T·N and a correction k·pM. To analyze the correction term in more detail, a standard polynomial factorization yields a standard polynomial A(x) and a roster of pairs of standard polynomials (U(x), V(x)) such that

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))−v(x)≡0 (SPpk).  (87)


Consider the case where k=[M,M−1, . . . , 2,1]. Then, evaluating at x=p yields

(A(p)−U(p)−V(p))(A(p)+U(p)−V(p))≡v(p) (mod pM).


This equation implies that the difference

(A(p)−U(p)−V(p))(A(p)+U(p)−V(p))−v(p)

is a multiple of pM, which shall be thought of as a carry, comprised of the carries from the individual terms of the difference (A−U−V)(A+U−V)−v, and deferred to the final phase of the process.


In the carry phase, the roles of the correction term and main term are reversed. What was formerly the correction term, the “carry” −k·pM is now the main term. And what was formerly the main term T·N is now the correction.


Geometric Semigroup Law

Henceforth, set A=A(p), U=U(p), V=V(p) with U≡0 (mod p), V≡0 (mod p2), Let C be an integer for which (A−U−V)(A+U−V)−N≡C (mod V), which is to say that:

(A−U−V)(A+U−V)−N=BV+C

for some integers B and C. Assume that C does not share a factor with N. Regard the integer V as a parameter and consider the quadratic polynomial in V:

q(V)=(A−U−V)(A+U−V)−BV−C.


Note that q(V)≡0 (mod N0). The discriminant of this quadratic is

Δ=B2+4(U2+AB+C).


To facilitate the goal of factorization of q(V), it is desired to change parameters (U, V, C) such that the discriminant becomes a perfect square, because in this case Δ will factor over the integers.


A set of rescalings of the parameters is proposed that shall preserve the property of being a perfect square. Specifically, rescale U, V, C such that CU and UV remain constant. To this end, introduce free homogeneous parameters X0, X1 and:

    • rescale C so that X0C′≡X1 (mod N0);
    • rescale V so that X1V≡X0CV′ (mod N0); and
    • rescale U so that X0U≡X1U′ (mod N0).


Prolong by introducing a parameter X2 such that C2Δ=X22 (mod N), and X3 such that X0X3≡X12 (mod N). Then points [X0, X1, X2, X3] are desired such that the quadratic equations are satisfied:














Q
1

:






X
0



X
3


-

X
1
2






0




(

mod



N
0


)







Q
2

:





4


X
1



X
3


+


(


B
2

+

4

A

B


)



X
0



X
3


+

4


U
2



C
2



X
0
2


-

4


X
2
2







0




(

mod



N
0


)




}




(
88
)







A factor is found once one of the scaling parameters [X0, X1, X2, X3] has a non-trivial factor in common with N. Note that the first equation of (88) is a cylinder over a plane conic. The lines X0, X1, X3=constant are the reguli of the cylinder. An initial non-trivial point on the intersection is [X0, X1, X2, X3]=[1,0,CU,0].


The following operations are well-defined on the quartuples P: [X0, X1, X2, X3] satisfying (88), are defined:


The point [X0, X1, −X2, X3] is the other point on the quadric Q2 lying on the same regulus as P.


Given two points in general position P: [X0, X1, X2, X3], Q: [Y0, Y1, Y2, Y3], there is a third point R: [Z0, Z1, Z2, Z3] satisfying both (88) such that OPQR are coplanar, where O=[0,0,0,1].


Let a=(B2/4+AB) mod N0. Let [X0, X1, X2, X3] be coordinates of the first point and [Y0, Y1, Y2, Y3] coordinates of the second point, so the congruences hold:

X22≡X1X3+aX0X3+C2U2X02 (mod N0)
Y22≡Y1Y3+aY0Y3+C2U2Y02 (mod N0).


Then the coordinates of the third point [Z0, Z1, Z2, Z3] are determined mod N0 by:

    • If [X0: X1: X2: X3]=[Y0: Y1: Y2: Y3], then










Z
0

=


16


X
0
4



X
2
4









Z
1

=



X
0
4




X
2
2

(


4


X
3
2


-

1

6


C
2



U
2



X
0
2


a

-

3

2


C
2



U
2



X
0



X
1



)









Z
2

=



-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

3

6


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

5

4


X
0



X
1
5


a

-








-
36



X
0
2



X
1
2



X
2
2


a

+

2

7


X
1
6


-

3

6


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)









Z
3

=



(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2










    • Otherwise,













Z
0

=




(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2



Y
0
2









Z
1

=



X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


C
2



U




X
0



y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)









Z
2

=



X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



C
2



U
2



X
0



X
2



Y
0
2


+

4


C
2



U
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+








+
3



X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-







-
2



a

(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)









Z
3

=



(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








-

X
0
2




X
1



Y
0



Y
1
2


+


X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2








The following theorem motivates this choice of polynomial transformation:


Theorem 6. Suppose that the points [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] obey (88). Then [Z0: Z1: Z2: Z3] given above also satisfies (88).


This can be proven by a brute-force calculation.


Polynomial Reformulation

Similarly to how the integer factorization problem can be partially reformulated using standard polynomials, the treatment of the carries can be reformulated using polynomial operations. This reformulation has the advantage of being more general than the prior discussion.


Suppose that A(x) has been determined, and U(x) is a polynomial coming from a standard polynomial factorization of v. There is an associated polynomial V(x), such that

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (mod p).


The carry is the obstruction to factorization of N that comes when evaluated at x=p:

(A−U−V)(A+U−V)−N

where the notations are used A=A(p), U=U(p), V=V(p). One would like a way to manipulate this carry in order to guarantee a greater likelihood of factorization. To that end, let C be an integer for which (A−U−V)(A+U−V)−N≡C (mod V), which is to say that:

(A−U−V)(A+U−V)−N=BV+C

for some integer C. Assume that C does not share a factor with N. Replace the integer V by an indeterminate v, and then consider the quadratic polynomial in v:

q(v)=(A−U−v)(A+U−v)−Bv−C.


Note that q(V)≡0 (mod N). The constants A, U , B, C are regarded as parameters in this quadratic. In particular, its discriminant

Δ=B2+4(U2+AB+C)

depends on all four parameters. To change parameters to achieve a factorization, first rescale the parameters v, C, U, in such a way that Uv, UC, and v/C mod N0 remain constant (modulo N0). Consider therefore a residue x modulo N0, and rescalings of the form v→xv, C→xC mod N0, and U→x−1U where x−1 is computed modulo N0 so that xx−1≡1 (mod N0). (Assume that x has no factor in common with N0.) The new quadratic is thus

{tilde over (q)}(v)=(A−x−1U−xv)(A+x−1U−xv)−xBv−xC,

and the new discriminant modulo N0 is

{tilde over (Δ)}≡4Cx3+(B2+4AB)x2+4U2 (mod N0).


Now, it is desired that the discriminant becomes a perfect square modulo N0. That is, a solution is desired to

y2≡{tilde over (Δ)} (mod N0).


That is

y2≡4Cx3+(B2+4AB)x2+4U2 (mod N0).


Multiply both sides by C2/4 (mod N0):









C
2

4



y
2






C
3



x
3


+


(



B
2

4

+

A

B


)



C
2



x
2


+


C
2





U
2

(

mod



N
0


)

.







Letting Y=Cy/2 and X=Cx, this equation becomes










y
2




X
3

+


(



B
2

4

+

A

B


)



X
2


+


C
2





U
2


(

mod



N
0


)

.







(
89
)







Let f(X) denote the right-hand side of (89). Associate to any solution of (89) an affine-linear form ξ with the property that ξ(X)=0. The pair (ξ, Y) can be used in place of a solution (X, Y).


Note that ξ(X)=0, Y=CU is a solution. The following semigroup law takes a pair of solutions (ξ1, Y1) and (ξ2, Y2) and produces a third solution (ξ3, Y3).

    • If degξ1<1, then let (ξ3, Y3)←(ξ2, Y2). Else degξ2<1, then let (ξ3, Y3)←(ξ1, Y1). Return (ξ3, Y3) and exit.
    • Else let g=gcd(ξ1, ξ2).
    • If g=1, let μ be the linear polynomial such that μ≡Yi (mod for i=1,2. Let ξ3=(f−μ2)/(ξ1ξ2), and let Y3 be the value of μ evaluated at the zero of ξ3. Return the pair (ξ3, Y3) and exit.
    • Else if Y1+Y2=0, then return (ξ3, Y3)←(1,0) and exit.
    • Otherwise, let μ=((Y1+f/Y1)/2) mod ξ12, where the multiplicative inverses are determined modulo N0. Then let ξ3=(f−μ2)/(ξ12), and let Y3 be the value of μ evaluated at the zero of ξ3. Return (ξ3, Y3) and exit.


To turn this into a factorization method, it is desirable to have versions of the polynomial extended Euclid algorithm (xgcd) and Chinese remainder theorem (crt) that return a factor if their inputs are degenerate modulo N0: i.e., if a factor is “discovered” by polynomial division.


The Semigroup Law in General

In general, suppose that F is a (fixed) squarefree polynomial modulo N0 of even degree 2k≥4. Let ∂ be the set of polynomials (α(x), β(x), γ(x)) modulo N, where β is a monic polynomial, degα<degβ<k and

α(x)2≡F(x)+β(x)γ(x) (mod N0).


Define a binary operation ⊕ on δ as follows. Suppose given a pair X1=(α1, β1, γ1), X2=(α2, β2, γ2). Let δ be the greatest common divisor of β1, β2, and d the greatest common divisor of α12, β1, β2. Let β32/d2 mod N0. Then there exists a polynomial α3 of degree<degβ3 such that

α3≡α1 (mod β1/δ)
α3≡α2 (mod β2/δ)
F−α32≡0 (mod β3).


To determine this α3, there exist polynomials σ1 and and σ2 such that

σ1β12β2≡δ (mod N0)

and polynomials ρ and ϵ such that

ρδ+ϵ(α12)≡d (mod N0).


Then







α
3

=


1
d



(


ρ

(



σ
2



β
2



α
1


+


σ
1



β
1



α
2



)

+

ϵ

(

F
+


α
1



α
2



)


)




(

mod



β
3


)

.






Next, put







γ
3

=



F
-

α
3
2



β
3





(

mod



N
0


)

.






While degβ3≥k, let








β
3

=

γ
3


,


γ
3

=



F
-

α
3
2



β
3




(

mod



N
0


)



,





and

α3=−α3 (mod β3).


Finally make β3 monic by dividing by its leading coefficient. The binary operation ⊕ is thus defined as

X1⊕X2=X3

where

X3=(α3, β3, γ3).


Since N0 is assumed to be composite, the polynomial division operations (or the normalization of β3 in the last step) of the semigroup law may not be well defined. In that case, a factor of N0 shall have been discovered, and the process terminates.


Examples
Small Example

Let N0=797×991=789827. Select the parameters p=13, M=4, and k=[1,1,1,1]. Note that N0 is a quadratic residue mod p, so that α=1 is a possible candidate α. Note that T=790087 is a prime greater than N0 such that N0≡Tα2 (mod p). Then, with N=TN0=624032044949, the digits of N modulo p form the polynomial:

v(x)=1+5x+5x2+6x3+9x4+7x5+12x6+12x7+10x8+6x9+4x10.


Modulo p=13, this polynomial factorizes as:

v(x)=(4)(x2+8)(x3+6x2+4x+1)(x5+2x4+11x3+7x2+11x+11).


The coefficients ω0, ω1, ω2, ω3 are determined so that

A(x)=ω01x+ω2x23x3

obeys

A(x)2≡v(x) (mod p, x4).


To begin the process, let ω0 be a root of ω02≡v0 (mod p), for instance ω0=1 satisfies 12≡1 (mod 13). The remaining coefficients wi must satisfy congruences

v1≡2ω0ω1 (mod p)
v2≡2ω0ω212 (mod p)
v3≡2ω0ω3+2ω1ω2 (mod p)


The first of these congruences reads

5≡2ω1 (mod 13)

and a solution of ω1=9 is found by modular inversion (2−1≡7 (mod 13)). The second congruence now reads

5≡2ω2+3 (mod 13)

giving ω2=1. The third congruence is now

6≡2ω3+18 (mod 13)


That is, 2ω3≡1 (mod 13), giving ω3=7. Thus the polynomial

A(x)=1+9x+x2+7x3

satisfies

A(x)2≡v(x) (SPpk)


With the trivial divisor of 1, the associated polynomial U is










U
=


SP

p
k


(



ω
0

2



(

1
-

v

v
0



)


)







=


4

x

+

4


x
2


+

10


x
3







.




The polynomial V is now determined from the data of v, A, U as

V=A±√{square root over (v+U2)} (SP)

where the square root is taken in pk-standard polynomials, and the sign is chosen so that the result is O(x2). Note that

v+U2≡1+5x+8x2+12x3 (SP).


Denoting √{square root over (v+U2)}=σ01x+σ2x23x3 (SP), the unknown coefficients σ0, σ1, σ2, σ3 must obey

1≡σ02 (mod p)
5≡2σ0σ1 (mod p)
8≡2σ0σ212 (mod p)
12≡2σ0σ3+2σ1σ2 (mod p)

where the integers on the left-hand side are the corresponding coefficients of the standard part of v+U2. Solving this system as above gives or σ00=1, σ11=9, σ2=9, σ3=3. Thus:

V=A−(1+9x+9x2+3x3)≡4x2+5x3 (mod 13).


In summary, the polynomials A, U, V are

A(x)=1+9x+x2+7x3
U(x)=4x+4x2+10x3
V(x)=4x2+5x3


Evaluating these polynomials at x=p gives integers

A(p)=15666, U(p)=22698, V(p)=9633

which are henceforth denoted A, U, V, respectively.


However, observe that the difference

(A−U−V)(A+U−V)−N=−624510847064

is not zero, nor do either r=A−U−V nor s=A+U−V share a nontrivial factor with N0. So, decompose the difference mod V:

−624510847064=(−64830359)V+1183.


This gives values for the parameters B=−64830359 and C=1183.


The objective is now to consider variables x such that the discriminant









Δ
=


x
3

+


(



B
2

4

+
AB

)



x
2


+


U
2



C
2







mod



N
0







=


x
3

+

536317


x
2


+
154667











is a perfect square modulo N0. To that end, let (ξ1, y1) be a pair comprising the monic affine -linear form ξ1 modulo N0 in one variable, and the integer y1 modulo N0, given by:

ξ1=x,
y1=CU mod N0=787443.


The pair (ξ1, y1) is the initial point for an iteration. The next point in the iteration (ξ2, y2) shall be determined as follows:

    • Let ξ212=x2 and y2=(Δ+y12) mod ξ2=152283.
    • Now let







ξ
2

=


Δ
-

y
2
2



ξ
2







and y2=y2 mod ξ2. So ξ2=x+536317 and y2=2384.


To find the next point (ξn+1, yn+1) from the previous point (ξn, yn), the following procedure can be used.

    • If ξn≡ξ1 (mod N0), let δ=ξ1, σ1=0, σn=1. Otherwise, ξn−ξ1 is a nonzero constant modulo N0. If it is not invertible modulo N0, then a factor is found. Otherwise, let δ=1, λ=(ξn−ξ1)−1 (mod N0), σ1=−λ, σ2=λ. In either case, one has σ1ξ1nξn=δ where δ is the polynomial gcd of ξ1 and ξn.
    • Next, if yn≡−y1 (mod N0), then let d=δ, ρ=1, ϵ=0. Else, if yn+y1 is not invertible modulo N0, it means that a factor is found. Otherwise, let d=1, ρ=0, and λ=(yn+y1)−1 mod N0. In any case, the congruence ρδ+ϵ(y1+yn)≡d (mod N0) now holds, where d is the polynomial gcd of δ and y1+yn.
    • Let ξn+1←ξnξ1/d2. Define yn+1 (mod N0) such that the congruence holds:

      dyn+1≡ρ(σ1ξ1ynnξny1)+ϵδ (mod ξn+1)

      where the modulo is with respect to polynomial division by ξn+1 (mod N0). (Note: because at this step, ξn+1 is guaranteed to be monic, no factorization will be discovered here.) If ξn+1 is quadratic rather than linear, then let







ξ

n
+
1






Δ
-

y

n
+
1

2



ξ

n
+
1



.





Test if the greatest common divisor of the leading coefficient of ξn+1 and N0 is nontrivial: if so, then it means a factor is found. Otherwise, normalize ξn+1 by dividing (modulo N0) by its leading coefficient. Now update yn+1:

yn+1←−yn+1 mod ξn+1,

with the same meaning of mod.


To illustrate, to find (ξ3, y3) given the previously determined (ξ1, y1) and (ξ2, y2), note that ξ2−ξ1=536317, whose inverse modulo N0 is 114631. Let δ=1, σ1=−114631 and σ2=114631. Now, y2≡−y1 (mod N0), so let d=δ=1, ρ=1, ϵ=0. Let







ξ
3

=




ξ
1



ξ
2



d
2


=


x
2

+

5

3

6

3

1

7

x








and










y
3

=



(



-
11


4

631


ξ
1



y
2


+

1

1

4

631


ξ
2



y
1



)


mod



ξ
3








=




(


-
11


4

6

3

1

)



(

2

3

8

4

)


x

+

1

1

4

6

3

1


(

7

8

7

4

4

3

)



(

x
+

5

3

6

3

17


)


mod



ξ
3









=



7895

0

3

x

+

7

8

7

4

4

3










after taking coefficients modulo N0 and obtaining the remainder from polynomial long division by ξ3. Because ξ3 is quadratic and not linear, replace it with








ξ
3




Δ
-

y
3
2



ξ
3



=

x
+
684851






and update y3 via

y3←−y3 (mod ξ3)=52047.


The results of continuing this process for successive iterations is presented in Table 1. The final line gives y=704548. The gcd with N0 is then gcd(N0, y)=gcd(789827,704548)=797, and so a factor of N0 has been found. (The other factor can be obtained by division: N0/797=991.)









TABLE 1







First seven iterations of the process













ξ


(
x
)


x








y
787443









x + 536317
  2384


x + 684851
 52047


x + 225605
682442


x + 572007
587941


x + 538246
275646


x + 369405
385164


x + 711460
704548









Large Example

Consider the integer of 201 digits, composed of two large prime factors:


N0=22967931147801119577057392151555297515908528818203114721284113333931 69938767039237859844411753308995545617879257906080518909576843342909 2047830345207451926941075428246929075122113723634319517491078477.


Let p=1299721 and α=89. The integer


T=229679311478011195770573921515552975159085288182031147212841133339316 99387670392378598444117533089955456178792579060805189095768433429092 047830345207451926941075428246929075122113723634319517592414719


is a prime greater than N0 such that N0≡Tα2 (mod p). Then


v=1008831 +1136976x1+956702x2+288775x3+618031x4+786694x5++959534x6+982257x7+1079763x8+606595x9+1119948x10+315803x11++163055x12+277569x13+397201x14+845775x15+325656x16+401316x17++938657x18+445914x19+700279x20+1078663x21+1021990x22+267966x23++980433x24+864073x25+424418x26+501729x27+36106x28+24162x29++27979x30+250922x31+289611x32+1050104x33+1050583x34+442750x35++1280878x36+1072587x37+460680x38+1126283x39+679997x40+1014612x41++1071670x42+478751x43+479058x44+1180741x45+832872x46+508143x47++63586x48+170412x49+851654x50+673439x51+1294284x52+760587x53++906884x54+973676x55+50261x56+1032425x57+903379x58+1286973x59++180314x60+1066029x61+213083x62+1032351x63+1284994x64+20x65.


It is now desired to find integers ω0, ω1, . . . modulo p such that









v
0






ω
0
2





(

mod


p

)






v
1






2


ω
0



ω
1






(

mod


p

)






v
2







2


ω
0



ω
2


+

ω
1
2






(

mod


p

)






v
3







2


ω
0



ω
3


+

2


ω
1



ω
2







(

mod


p

)






v
4







2


ω
0



ω
4


+

2


ω
1



ω
3


+

ω
2
2






(

mod


p

)

















v
k









i
=
0

k



ω
i



ω

k
-
i








(

mod


p

)


















With ω=649676, the unique integers ωi determined by these congruences are found in 1 millisecond on a single thread of an Intel(®) Core(™) i7-10700 CPU at 2.90 GHz, and are tabulated in Table 1, up to M=99.












ωi for 0 ≤ i < M = 99 in the example




















ω0
649676
ω1
176555
ω2
1210316


ω3
880935
ω4
990258
ω5
1193444


ω6
61049
ω7
404278
ω8
301580


ω9
869756
ω10
1182221
ω11
157526


ω12
106958
ω13
412412
ω14
97078


ω15
1058759
ω16
601585
ω17
283394


ω18
30547
ω19
1154202
ω20
85723


ω21
1230004
ω22
478092
ω23
124906


ω24
537915
ω25
1149285
ω26
811132


ω27
25307
ω28
181194
ω29
334252


ω30
1122689
ω31
1274176
ω32
582005


ω33
65984
ω34
767541
ω35
966192


ω36
26289
ω37
1255833
ω38
1277307


ω39
930123
ω40
666184
ω41
168986


ω42
1095395
ω43
653414
ω44
28041


ω45
353354
ω46
273125
ω47
980499


ω48
218587
ω49
739819
ω50
632834


ω51
1055915
ω52
715651
ω53
156745


ω54
885257
ω55
1024532
ω56
1188376


ω57
296168
ω58
474923
ω59
1083529


ω60
948621
ω61
1024778
ω62
539727


ω63
53812
ω64
176433
ω65
825291


ω66
1093610
ω67
91679
ω68
1019182


ω69
937590
ω70
754793
ω71
441590


ω72
343128
ω73
507560
ω74
272679


ω75
536524
ω76
1069159
ω77
255311


ω78
325334
ω79
919125
ω80
541698


ω81
995762
ω82
679297
ω83
910068


ω84
1116934
ω85
832307
ω86
1066863


ω87
302115
ω88
360316
ω89
188493


ω90
260955
ω91
286776
ω92
6525


ω93
1128692
ω94
842066
ω95
135610


ω96
382721
ω97
705108
ω98
658922









The complete factorization of v(x) modulo p is determined using the procedure described in 2 milliseconds on a single thread of an Intel(®) Core(™) i7-10700 CPU at 2.90 GHz:






v
=


(
20
)

×

(

x
+
1164545

)

×

(


x
3

+

401265


x
2


+

1232398

x

+
446873

)

×

(





x
25

+

1126379


x
24


+

1007770


x
23


+

566898


x
22


+

468042


x
21


+







1072384


x
20


+

1286593


x
19


+

1165876


x
18


+

531903


x
17


+

427926


x
16


+







731970


x
15


+

461270


x
14


+

245668


x
13


+

98598


x
12


+

641038


x
11


+







605298


x
10


+

217543


x
9


+

174186


x
8


+

1081462


x
7


+

315399


x
6


+







203594


x
5


+

659685


x
4


+


+
325480



x
3


+

150243


x
2


+

11211680

x

+





456996



)

×

(





x
36

+

361419


x
35


+

314100


x
34


+

375904


x
33


+

338514


x
32


+

648035


x
31


+







529983


x
30


+

640529


x
29


+

382523


x
28


+

920414


x
27


+

899851


x
26


+







276259


x
25


+

227435


x
24


+

1192845


x
23


+

262010


x
22


+

846862


x
21


+







475004


x
20


+

31544


x
19


+

1140348


x
18


+

914003


x
17


+

107624


x
16


+







350295


x
15


+

407742


x
14


+

138534


x
13


+

756626


x
12


+

391910


x
11


+







83332


x
10


+

741465


x
9


+

822812


x
8


+

456431


x
7


+

890299


x
6


+







181841


x
5


+

852774


x
4


+


+
499863



x
3


+

248842


x
2


+

107144

x

+
399396




)






Up to a constant multiple, there are 24=16 divisors of the polynomial v(x) modulo p, and so 16 pairs of polynomials (U(x),V(x)) to inspect. Inspecting all of these, the procedure discovers a factor at







U

(
x
)

=


1123

1

6

6

x

+

523890


x
2


+

9

2

7

1

4

2


x
3


+

167222


x
4


+

8

2

2

8

2

3


x
5


+

502764


x
6


+

583838


x
7


+

1249813


x
8


+

1012538


x
9


+

2

0

3

8

0

5


x

1

0



+

141747


x

1

1



+

1

4

5

3

1


x

1

2



+

729864


x

1

3



+

9

1

6

8

6

9


x

1

4



+

1

1

1

1

8

1

0


x

1

5



+

1205502


x

1

6



+

233558


x

1

7



+

2

7

0

2

3

7


x

1

8



+

159711


x

1

9



+

8

7

5

4

2

3


x

2

0



+

189604


x

2

1



+

411354


x

2

2



+

793239


x

2

3



+

2657


x

2

4



+

738498


x

2

5



+

9

9

7

7

4


x

2

6



+

1216546


x

2

7



+

683420


x

2

8



+

486140


x

2

9



+

7

4

6

7

9

9


x

3

0



+

997485


x

3

1



+

381191


x

3

2



+

2

0

7

1

3

8


x

3

3



+

443132


x

3

4



+

1075495


x

3

5



+

1035499


x

3

6



+

245944


x

3

7



+

5

5

0

7

2

4


x

3

8



+

1211194


x

3

9



+

206135


x
40


+

108418


x

4

1



+

62783


x
42


+

765632


x

4

3



+

1

0

5

7

9

8

2


x

4

4



+

1

1

4

0

8

9

6


x

4

5



+

594000


x

4

6



+

656521


x

4

7



+

3

2

4

2

2

2


x

4

8



+

898643


x

4

9



+

9

9

9

1

1

3


x

5

0



+

4

8

0

8

5

5


x

5

1



+

753753


x

5

2



+

1185547


x
53


+

9

7

8

1

2

9


x
54


+

523936


x
55


+

3

5

3

5

9


x
56


+

4

0

7

8

6

0


x

5

7



+

252530


x
58


+

700899


x
59


+

1

0

3

9

5

6

1


x

6

0



+

520664


x

6

1



+

2

4

7

1

3

7


x

6

2



+

1217984


x

6

3



+

200730


x

6

4



+

8

7

0

0

0

3



x

6

5


.







The entire procedure takes 5263 seconds on a Slurm cluster consisting of 4 PCs, each with 16 threads running on an Intel(®) Core(™) i7-10700 CPU at 2.90 GHz.


Appendices
The Euclidean Algorithm

The extended Euclidean algorithm is an iteration of the division algorithm that allows one to compute s, t such that

sa+tb=gcd(a, b),


Inputs: Positive integers a and b.


Outputs: Integers s,t,d

sa+tb=d

where

d=inf{sa+tb|s,tϵcustom character, sa+tb>0}

is the greatest common divisor of a and b.

    • 1. Let α←a, β←b, S←1, T←0, s←0, t←1
    • 2. If β=0 then output s, t, α and exit the program.
    • 3. Let q and r be the unique integers (from the division algorithm) such that

      α=qβ+r
    • 4. Let (S, s)←(s−q*S, S), (T, t)←(t−q*T, T), α←β, β←r, and go to 2.


Python Source Code

Here is an implementation in Python:

















def
  euclid(a, b) :




S=0




T=1




s=1




t=0




alpha  =  a




beta  =  b




while  beta  !=  0:













(q, r)  =  divmod(alpha, beta)





(S, s)  = (s−q*S, S)





(T, t)  =  (t−q*T, T)





alpha=beta





beta=r











return(s, t, alpha)









Modular Inversion

Given a modulus M and integer a relatively prime to M, a modular inverse of a is an integer b such that ab≡1 (mod M). The Euclidean algorithm can be used to determine a modular inverse as follows. Since a and M are relatively prime, apply the Euclidean algorithm to find integers s, t such that

sa+tM=1.


Then, sa=1−tM implies sa≡1 (mod M). That is b=s is a modular inverse of a.


Euclidean Algorithm for Polynomials Modulo N

Suppose that N is an integer, possibly composite.


Inputs: Polynomials a and b modulo N.


Outputs: Integers s, t, d such that

sa+tb=d

where

degd=inf{deg(sa+tb)|s,tϵcustom character, sa+tb≠0}

is the greatest common divisor of a and b, or else a nontrivial factor of N.

    • 1. Let α←a, β←b, S←1, T←0, s←0, t←1
    • 2. If β=0, then let α0 be the leading coefficient of α. If α0 is not coprime to N, then output their greatest common divisor. Else, output s/a0, t/a0, a/a0and exit the program.
    • 3. If the leading coefficient of β is not coprime with N, then output their greatest common divisor. Else let q and r be the unique polynomials (from the division algorithm) such that degr<degα and

      α=qβ+r
    • 4. Let (S, s)←(s−q*S, S), (T, t)←(t−q*T, T), α←β, β←r, and go to 2.












Python-Sage code


















def
  euclid(g, a, b) :




S=0




T=1




s=1




t=0




alpha  =  a




beta  =  b




while  beta  !=  0:













assert(s*a+t*b  ==  alpha  and  S*a+T*b  ==  beta)





betad0  =  beta.leading_coefficient( )





d  =  gcd(beta0,beta.base_ring( ).characteristic( ) )





if  d  >  1:















g.append(d)






return(alpha, s, t)













q  =  alpha  //  beta





r  =  alpha  %  beta





(S, s)  =  (s−q*S, S)





(T, t)  =  (t−g*q*T, T)





alpha=beta





beta=r









alpha0  =  alpha.leading_coefficient( )



d  =  gcd(beta0,beta.base_ring( ).characteristic( ) )



if  d  >  1:













g.append (d)









else:













alpha  =  alpha  /  alpha0





s  =  s  /  alpha0





t  =  t  /  alpha0









return(alpha, s, t)









Chinese Remainder Theorem

A version of the Chinese remainder theorem is needed that operates on polynomials modulo N, in the following sense. Suppose that x1 and x2 are two given polynomials modulo N and m1 and m2 are relatively prime, meaning that there exist u1 and u2 such that u1m1+u2m2≡1 (mod N). Then there exists a polynomial x such that x≡x2 (mod m1) and x≡x2 (mod m2), namely x=x1u2m2+x2u1m1. The polynomial x is unique modulo m1m2.


The following algorithm is sufficient to produce the required polynomial x, or else to produce a factor of N.















def
  crt_f(g, x1, x2, m1, m2) :



(d, u1, u2)  =  euclid(g, m1, m2)











if  d.degree( )  >  0  and  g  ==  [ ] :













print(″Unsupported:  m1  and  m2  must  be  coprime″)











elif  d  !=  1  and  g  ==  [ ] :













d  =  gcd(d[0],d.base_ring( ).characteristic( ) )





g.apend(d)











return(x1*u2*m2 + x2*u1*m1)









Digit Expansions
Division Theorem

Suppose that p is prime and N, r are given integers. It is of interest to determine whether there is an integer s such that

N≡rs (mod pk).  (90)


Basically one can perform ordinary digitwise long division to compute s mod pk for which this holds. Note that this can be done for any r that is not divisible by p, so that solutions of (90) do not confer anything about potential factors of N. More precisely:


Theorem 7. Let N be an integer. For any integer r not divisible by p, there exists for every positive k a unique integer s with 0≤S s<pk such that (90) holds. The solution s=sk to (90) depends only on the reduction of r modulo pk. Furthermore, when r is fixed, sk≡sl (mod pk) whenever k<l.


Proof. Since p is prime and r is not divisible by p, gcd(r, pk)=1 for all k≥0. From the division algorithm, there exist integers αk, βk such that

αkr+βkpk=1.  (91)


Moreover, the residues αk (mod pk), βk (mod r) of a pair satisfying (91), are uniquely determined. Let s be the unique residue in 0≤s<pk such that Nαk≡s (mod pk). Then

rs≡N·(αkr)=N·(1−βkpk)=N−βkNpk≡N (mod pk).


This proves existence.


For the uniqueness of the residue sk (mod pk), suppose s, s′ both satisfy (90). Then rs≡rs′ (mod pk), or r·(s−s′)≡0 (mod pk). Since r is not divisible by p, this implies that pk|(s−s′). That is, s≡s′ (mod pk). The residue sk (mod pk) is thus unique.


Finally, since s=sk and s=sl both satisfy N≡rs (mod pk), it follows by uniqueness of the residue sk that sl≡sk mod pk. □


Long Division

Corollary 1. Given the integers N and r as in Theorem 7, there exists a unique sequence of digits (a0, a1, . . . ) having the property that, for each k, N≡r·(a0+a1p+a2p2+ . . . +akpk) (mod pk+1).


One way to find the sequence ai is by “long division” of r into N, working from the lowest digits to the highest (unlike ordinary long division, which works from the most significant to least).


For example, long division of 137/352 in base p=5 returns the sequence of digits (up to the 18th digit);

1,1,3,4,4,4,2,2,1,4,1,2,4,0,1,1,4,3 . . .


That is,







s

1

8


=


1
+

1

p

+

3


p
2


+

4


p
3


+

4


p
4


+

4


p
5


+

2


p
6


+

2


p
7


+

1


p
8


+

4


p
9


+

1


p

1

0



+


2


p

1

1



+

4


p

1

2



+

0


p

1

3



+

1


p

1

4



+

1


p
15


+

4


p

1

6



+

3


p

1

7




=

293

6

8

8

3
406206.






This integer satisfies

352·s18≡137 (mod pk)

for k=1, 2, . . . , 18.


The long division can be prolonged to obtain more terms of the digit sequence. For example,







S

2

4


=


1
+

1

p

+

3


p
2


+

4


p
3


+

4


p
4


+

4


p
5


+

2


p
6


+

2


p
7


+

1


p
8


+

4


p
9


+

1


p

1

0



+


2


p

1

1



+

4


p

1

2



+

0


p

1

3



+

1


p

1

4



+

1


p

1

5



+

4


p

1

6



+

3


p

1

7



+

2


p

1

8



+


0


p

1

9



+

3


p

2

0



+

3


p

2

1



+

0


p

2

2



+

2


p

2

3




=

255

6

9

0

3

7

9

5

7

6

2

4

956







which satisfies

352·s24≡137 (mod pk)

for k=1,2, . . . ,24.


However, despite the fact that and 352·sk≡137 (mod 5k) for all k, and sk and sl will share the first k digits whenever l≥k, there is clearly no integer s that satisfies 352·s=137.


Factorization by Trial Division

Consider an example where an integer N=rs has been prepared, say N=250641205046503. With p=29, one has

N=10+14p+11p2+4p3+14p4+24p5+0p6+1p7+8p8+17p9.


The goal of factorization is to find integers r, s>1 such that N=r·s. Assuming r is a candidate divisor, a possible s can be constructed using long division. For example, if a hypothesis is made that the first two digits of r are 12 and 6, that is r≡12+6p (mod p2). Then an s, should it exist, would be found by long division of r into N, tabulated in (92).

















25


12




12


6


10


14










10


15













28













28






(
92
)







Note that there is no obstruction to performing the division out to this number of digits. Corollary 1 implies that “long division” can be carried out to arbitrarily many digits, so there will never be an obstruction. Information on whether r is a divisor of N must therefore come from a magnitude constraint: that is, is the resulting quotient s obtained by long division null-terminated? Since the product (25+12·p) (12+6·p) has fewer digits than N, no information is inferred on whether r could be a divisor of N from this division. It is necessary to consider more digits.


For example, hypothesizing that

r=12+6p+1p2+5p3,

then (93) tabulates the resulting long division.























25


12


21


4




12


6


1


5


10


14


11


4
















10


15


1


10



















28


9


23



















28


18


14






















20


8






















20


18

























19

























19






(
93
)







Because the integer r·s is still not as long as N, it is required to specify still more digits. Since N has ten digits mod p, it will only be possible for r·s to have enough digits if at least six digits of r are known. For example, hypothesizing that

r=12+6p+1p2+5p3+23p4+26p5,

the answer is tabulated in (94).





























25


12


21


4


4


18


23


6


20


21




12


6


1


5


23


26


10


14


11


4


14


24


0


1


8


17






















10


15


1


10


28


2


23


































28


9


23


14


21


6


0


8


17

























28


18


14


2


17


2


11


































20


8


12


4


4


18


7


17




























20


18


25


18


22


11


19


































19


15


14


10


6


17


16































19


25


4


20


5


20


3


































19


9


19


0


26


12


































19


25


4


20


5


20







































13



14


9


20


21





































13


28


21


3


11








































15


16


16


10








































15


2


28


28











































14


17


10











































14


9


7














































8


3














































8


12

















































20

















































20






(
94
)







Only now, in (94), does it become clear that there is no divisor r≡12 +6p+1p2+5p3+23p4+26p5 (mod p6), because the product of r and the digit sequence s resulting from long division (mod p6) has more digits than the integer N to be factored.


A seemingly plausible way to factor is to inspect all choices of digits in r, testing whether there is an s such that rs=N. Unfortunately, Corollary 1 implies that any selection of digits in r, provided the first digit is not zero, gives rise to a unique digit sequence s. This digit sequence corresponds to an integer if and only if it terminates. However, to check the termination condition requires to carry the long division out far enough. This example illustrates a general principle that no information on the feasibility of a factor r can be determined until about half the digits of N are specified. So searching over r and using long division is no better than brute force trial division,


Inversion Modulo pk

Related to the problem of division modulo powers of p is that of inversion: given the digits of an integer a, to find a digit expansion x such that xa≡1 (mod pk). The following theorem characterizes the solutions to this problem. Later an algorithm shall be given for finding them.


Theorem 8. Let p be prime and a an integer not divisible by p. Then, for any positive integer k, there exists a unique integer xk between 0 and pk such that xka≡1 (mod pk). Furthermore, if k<l, then xl≡xk (mod pk).


Proof For uniqueness, suppose that two solutions xk and yk are given. Then:

(xk−yk)a≡0 (mod pk).


Since p is prime and does not divide a, it follows that pk|(xk−yk). That is, xk−yk≡0 (mod pk) or xk≡yk (mod pk). Because xk and yk are between 0 and pk by assumption, they must therefore be equal.


For existence, since a is prime to pk, the Euclidean algorithm gives integers s, t such that

sa+tpk=1.


Thus sa≡1 (mod pk), so setting xk=s mod pk gives the required (unique) solution. □


An alternative algorithm can be given that usually requires fewer divisions. Specifically, an iteration is given that computes x2j. The case of general xk can be inferred from this by exploiting the uniqueness established in the theorem: xk=x2j (mod pk) for any power of two 2j≥k.


For j=0, the Euclidean algorithm is applied to obtain s, t such that sa+tp=1. Then take x1=s mod p, which then satisfies x1a≡1 (mod p). Next, supposing that x2j has been calculated, let

x2j+1=(2−x2jα)x2j mod p2j+1.


Let |·|p denote the p-adic norm on the integers:

|n|p=inf{p−r|pr|n}.


Note that

|1−x1α|p≤p−1  (95)

because p divides 1−x1a. It shall be shown that

|1−x2j+1α|p≤|1−x2jα|p2.  (96)


From (95) and (96) it follows by induction that

|1−x2jα|p≤p−2j

for all j; that is:

x2jα≡1 (mod p2j),

as required.


It remains to show that (96) holds. Consider:










1
-


x

2

j
+
1




a


=


1
-

2


(

2
-


x

2
j



a


)



x

2

j



a








=



(

1
-


x

2

j



a


)

-


(

1
-


x

2
j



a


)



x

2
j



a








=




(

1
-


x

2
j



a


)

2

.








So (96) now follows by multiplicativity of the norm.


The Algorithm

To summarize, the following algorithm can be used for inversion:


Inputs: A prime p, non-negative integer j, and integer a that is not divisible by p.


Output: An integer 0<x2k<p2k such that x2kα≡1 (mod p2k).

    • 1. Let (s, t, 1) be the output of the Euclidean algorithm with inputs a and p, so that

      sa+tp=1.


Let x←s mod p.


2. For j=1 to k, let x←(2−x*a)*x mod p2k.


3. Return x.


Python Source Code

Here is an implementation:














#Compute  the  inverse  of  modulo  p{circumflex over ( )}(2{circumflex over ( )}k)








def
  modInv(a, p, k) :



(s, t, d)  =  euclid(a, p)



x=s  %  p



q=p



for  _  in  range (0, k) :











q  *=  q




x  =  ( (2−x*a) *x)  %  q









return(x)









Square Root of Digit Expansions

Let N be a quadratic residue modulo p.


Theorem 9. Let p be an odd prime and N a positive integer not divisible by p. Suppose that 0≤A1<p satisfies A12≡N (mod p). Then, for any positive integer k there exists a unique integer Ak in 0≤Ak<pk such that Ak2≡N (mod pk) and Ak≡=A1 (mod p). Furthermore, if k<l, then Al≡Ak (mod pk).


Proof For uniqueness, if Ak, Bk are two solutions between 0 and pk, then

Ak2−Bk2=(Ak−Bk)(Ak+Bk)≡0 (mod pk).


Reducing modulo p, it follows that p divides Ak−Bk. If p were to also divide Ak+Bk, then p would divide Akand Bk, and therefore would also divide N (because Ak2≡N (mod p)). But this is contrary to the choice of N. Therefore, pk divides Ak−Bk. That is Ak≡Bk (mod pk). Since Ak and Bk are between 0 and pk by hypothesis, this implies Ak=Bk, and hence uniqueness. The last statement of the theorem is a consequence of the uniqueness, since Ak and Al satisfy Ak2≡N (mod pk) and Al2≡N (mod pk) implies that Al≡Ak (mod pk).


This leaves only the matter of existence. The solution Ak is computed as Ak=A2j mod pk for a power of two 2j≥k. The solution with k=2j is constructed by the following iteration

A2j+1=2−1(A2j+NA2j−1)  (97)

where the inverses are computed modulo p2j+1 using the algorithm of inversion modulo p.


Note that |N−A12|p≤p−1. It will be shown that

|N−A2j+12|p=|N−A2j|2

so that, by induction,

|N−A2j2|p=p−2j,

i.e.,

A2j2≡N (mod p2j),

as desired.


To prove it, denote by 1/A2j the inverse of A2j modulo p2j+1. Then:










N
-

A

2

j
+
1


2





N
-


1
4



A

2
j

2


-


1
2


N

-


1
4



N
2



A

2
j


-
2















1
2



(

N
-

A

2
j

2


)


+


1
4



(


A

2
j

2

-


N
2


A

2
j

2



)














1
2



(

N
-

A

2
j

2


)


+


1
2




A

2

j
+
1





A
2


j




(


A

2
j


-

N

A

2
j




)













1
2



(

N
-

A

2
j

2


)



(

1
-



A

2
j


+
1


A

2
j




)





(

mod



p

2

j
+
1




)

.









Next, note that







1
-


A

2

j
+
1




A

2
j







1
2




(


N
-

A

2
j

2



A

2
j



)

.






Substituting into the above now gives







N
-

A

2

j
+
1


2





1
4




(

N
-

A

2
j

2


)

2



A

2
j


-
1








and therefore, by multiplicativity of the norm and since |A2j|p=1,

|N−A2j+12|p=|N−A2j2|p′2

as required. □


The Algorithm

The proof above contains the following algorithm, optimized to compute all of the required inverses together with the iterations.


Inputs: An odd prime p, integer N, integer A1 such that A12≡N (mod p), and a non -negative integer k.


Output: An integer A2k such that A2k2≡N (mod p2k).


1. If k=0 then output A1 and exit. Else continue.


2. Let (s, t, 1) be the result of applying the Euclidean algorithm with inputs 2 and p, so that 2s+pt=1. Let s←mod p.


3. Let A←A1, q←p.


4. Let (u, v, 1) be the result of applying the Euclidean algorithm with inputs A1 and p, so that A1u+pv=1. Let u←u mod p.


5. For j=1 to k repeat:

    • q←q*q
    • s←2*(1−s)*s (mod q)
    • u←(2−u*A)*u (mod q)
    • u←(2−u*A)*u (mod q)
    • A←s*(A+N*u) (mod q)


6. Return A.


(Note the repeated step in the inner loop.)












Python source code















#Return the A such that A{circumflex over ( )}2 == N (mod p{circumflex over ( )}(2{circumflex over ( )}k) ) and A==A1 (mod p)


#Uses the algorithm euclid(a,b) from earlier








def
  modSqrt(N, A1, p, k) :



if  k==0:











return(A1  %  p)









q=p



(s, _, _)  =  euclid(2, p)



s  =  s  %  p



(u, _, _)  =  euclid (A1, p)



u  =u  %  p



A=  A1  %  p



for  j  in  range(0, k) :











q  *=  q




s= (2*s* (1−s) )  %  q




u= (u* (2−u*A) )  %  q




u= (u* (2−u*A) )  %  q




A= (s* (A+N*u) )  %  q









return (A)









Infinite Digit Expansions:

Naturally an infinite digit expansion cannot be fully represented on a computer, so consider such digit expansions as a computation that can be continued indefinitely:

    • An infinite digit expansion is a rule that, for each n=0,1 . . . , given the first n digits (x0, x1, . . . , xn−1), gives the next digit xn.


In representing an infinite digit expansion in computer memory, it is necessary to truncate it to some machine-sized limit. If such a cutoff is employed, it shall be chosen large enough not to interfere with any relevant features of the problem.


Carry Arithmetic

A digit expansion shall be a sequence of integers (x0, x1, . . . ) with 0≤x1<p, i=0,1, . . . Sequences can be subjected to the usual rules of addition-with-carry, multiplication-with -carry, subtraction-with-borrow, without regard for their size. Note that it is necessary to introduce some non-terminating sequences. For example, with p=5, the difference (3+5+52)−(1+2·5+52) can be found. After subtracting one from three without difficulty in the ones' place, it is now required to subtract two from one in the p's place, so a borrow of one. That leaves a deficit of one in the p2 place, so it is then necessary to borrow one from the next place, and so forth. Note that borrowing converts a 0 into p−1 (=4) plus a borrow from the next digit. Taken out to several digits, that is:











3


1


1


0


0


0




-


1


2


1


0


0


0




-


-


-


-


-


-


-







2


4


4


4


4


4






But clearly this process of borrowing from 0 can be continued indefinitely, and the outcome of this computation is the non-terminating sequence (2,4,4,4,4, . . . ). It is also instructive to reverse the process, adding (1,2,1) to (2,4,4,4, . . . ):











2


4


4


4


4


4




+


1


2


1


0


0


0




-


-


-


-


-


-


-







3


1


1


0


0


0






All of the borrows are now carries: whenever a 1 overflows into a 4, it gives zero with a carry of one to the next 4 in the chain, and so on ad infinitum.


It is convenient to identify the sequence (x0, x1, . . . ) with a formal sum of powers of p,






x
=




n
=
0





x
n




p
n

.







Then the arithmetic operations have their usual meanings, with carry, on infinite expressions.


Explicitly, suppose









x
=




n
=
0





x
n



p
n









y
=




n
=
0





y
n




p
n

.










Then the following rules hold:


Addition






x
+
y

=




n
=
0





z
n



p
n








where for n=0,1, . . . ,

zn=(xn+yn+cn) mod p,
cn+1=└(xn+yn+cn)/p┘

and c0=0.


Subtraction






x
-
y

=




n
=
0





z
n



p
n








where for n=0,1, . . . ,

zn=(xn−yn+cn) mod p,
cn+1=└(xn−yn+cn)/p┘

and c0=0.


Multiplication






x
·
y

=




n
=
0





z
n



p
n








where for n=0,1, . . . ,







z
n

=


(


c
n

+




k
=
0

n



x
k



y

n
-
k





)


mod


p








c

n
+
1


=




p

-
1


(


c
n

+




k
=
0

n



x
k



y

n
-
k





)








and c0=0.


Theorem 9 can be reformulated using infinite digit expansions:


Theorem 10. Let p be an odd prime and N a positive integer not divisible by p. Suppose that 0≤a0<p satisfies a02≡N (mod p). Then there exists a unique digit expansion A=(a0, a1, . . . ) such that A2=N.


Every quadratic residue has a square root.


Clearly not every quadratic residue is a perfect square. For example, the integer 6 is a quadratic residue modulo 5, but is plainly not a perfect square.


However, because of Theorem 10, any integer N that is a quadratic residue modulo p is a “perfect square” in the sense that there exists a digit expansion A such that N=A2. Clearly such a digit expansion A must be infinite, unless N is a perfect square in the usual sense, as the example N=6, p=5 shows.


Because of Theorem 10, it is possible to solve the equation N=r·s, with the constraint that r and s have the same digits as one another (i.e., s=r). So although N has a “factorization” N=r·s where r and s are the same digit sequence, this common digit sequence does not terminate (unless N is a perfect square, which it is not in these applications). The algorithm described in conjunction with Theorem 9 supplies a rule for producing as many digits of the expansion A as desired.


In the example of 6 modulo 5, if A denotes the infinite digit expansion

A=1+3·5+0·52+4·53+2·54+1·55+2·56+3·57+1·58+3·59+ . . .

then

A21+1·5+0·52+0·53+0·54+0·55+0·56+0·57+0·58+0.·59+ . . .

i.e., one has

A2=6

even though obviously no integer has this property.


Congruences

Definition 7. Let A, B, M be integers. The notation

A≡B (mod M)

means that there exists an integer k such that



A=B+kM.


Here are properties of integer congruences:


Proposition 3





    • (a) A≡A (mod M).

    • (b) For any integer l, lM≡0 (mod M).

    • (c) If A≡B (mod M) then B≡A (mod M).

    • (d) If l is a non-zero integer and A≡B (mod l)M, then A≡B (mod M).

    • (e) If A≡B (mod M) and C≡D (mod M), then A+C≡B+D (mod M) and AC≡BD (mod M).

    • (f) If A≡B (mod M) and f(x) is a polynomial with integer coefficients, then f(A)≡f(B) (mod M).





Proof





    • (a) Consider Definition 7 with k=0. Then A=A+kM. That is, A≡A (mod M).

    • (b) Taking k=1, M=0+1M, so M≡0 (mod M).

    • (c) If A=B+kM, then B=A−kM=A+(−k)M. That is, B≡A (mod M).

    • (d) If A≡B (mod M), then A=B+klM=B+(kl)M, so A≡B (mod M) (with kl playing the role of k in Definition 7).

    • (e) Suppose that A=B+kM and C=D+lM. Then A+C=B+D+(k+l)M and AC=BD+(Bl+Dk)M show, respectively, that A+C≡B+D and AC≡BD (mod M).

    • (f) This is true when f(x)=xk, by the previous part. It is true for f(x)=axk, by (a) and the previous part. Then it is true if f(x) is an arbitrary integral linear combination of power functions, again by the previous part.








Proposition 4. Let M be a positive integer. Then, for each integer A, there exists a unique integer r with 0≤r<M, such that A≡r (mod M).


Proof Recall that Euclidean division guarantees that there exist unique integers q and r, the quotient and remainder upon division of A by M , such that A=qM+r where the remainder satisfies 0>r<M. □


Theorem 11. If A and M are coprime integers, then, for any integer B, there exists an integer x such that Ax≡B (mod M). Moreover, there is a unique x in the interval 0≤x<M, and any two solutions differ by a multiple of M.


The uniqueness is of special importance here because of the fact that it is usually simpler to check whether an integer x satisfies Ax≡B (mod M) than it is to construct a solution. In cases where such solutions are desired, it is sufficient to check explicitly that the solution is correct: the details of the applications of the Euclidean division required to produce the solution in the first place can be omitted.


Proof The following lemma holds: the greatest common divisor of A and M is the least positive integer of the form sA+tM for integers s, t. To prove the lemma, let d=sA+tM be the least such positive integer. Since any common divisor of A and M divides d, it follows that gcd(A, M)|d. To show the opposite, that d divides A and M, and it is sufficient by symmetry to show that it divides A. Recall that if q and r are the quotient and remainder of division of A by d, then

A=qd+r

where 0≤r<d. To show that r=0, were it not the case, then note that r=A−qd=A−q(sA+tM)=(1−qs)A+(−qt)M is a positive integer of the form s′A+t′M that is less than d. But d was supposed to be the least such positive integer, so this contradicts the choice of d. Thus it has been shown that d|A. Since also then d|M by symmetry, it now follows that d|gcd(A, M) and now it is proven these positive integers divide one another and thus they are equal.


Returning to the proof of the theorem, since A, M are coprime, there are integers s and t such that As+Mt=1. Multiplying by B this is A(Bs)+M(Bt)=B so that A(Bs)≡B (mod M). Thus x=Bs is the required solution.


For uniqueness, suppose two solutions x, x′ are given, with 0≤x, x′<M, then A(x−x′)≡0 (mod M). Since A has no divisors in common with M, this implies that |x−x′| is divisible by M and the only integer in the interval 0≤|x−x′|<M with this property is |x−x′|=0, so x=x′. This completes the proof. □


Systems of Congruences

The systems of congruence employed here have the following form where p is a prime and the exponents ki are positive integers:









{





A
1






B
1





(

mod



p

k
1



)






A
2






B
2





(

mod



p

k
2



)

















A
m






B
m





(

mod



p

k
m



)




.





(
98
)







The following corollary to Proposition 3 holds:


Proposition 5. Suppose that the pairs of integers (Ai, Bi) satisfy the system (98) and ki′ are any positive integers such that ki′≤ki for 1≤i≤m. Then for any integer pairs (Ai′, Bi′) such that

Ai′≡Ai (mod pki′)
Bi′≡Bi (mod pki′)

for 1≤i≤m, the system of congruences (99) also holds:









{





A
1







B
1






(

mod




p

k
1





)






A
2







B
2






(

mod




p

k
2





)

















A
m







B
m






(

mod




p

k
m





)




.





(
99
)







This proposition facilitates checking certain systems of congruences by hand.


Lifting Solutions of Systems of Congruences

When a system of congruences (99) is obtained from (98) as in Proposition 5, the system of congruences (99) arises from (98) by truncation. Proposition 5 implies that every solution to a system of congruence is also a solution to its truncation.


The converse is not true. However, the following principle does hold: every solution to a truncated system of non-degenerate polynomial congruences can be prolonged to a solution of the original system.


In more detail,


Theorem 12. Let F1(X1, . . . , Xn), . . . , Fn(X1, . . . , Xn) be integer polynomials in the indeterminates X1, . . . , Xn. For any solution any positive integers k1, . . . , k1, and for every solution (X1*, X2*, . . . , Xn*) modulo p to the system of congruences










F
1
*

(


X
1
*

,


,

X
n
*


)





0







(

mod


p

)







F
2

(


X
1
*

,


,

X
n
*


)





0







(

mod


p

)





















F
M

(


X
1
*

,


,

X
n
*


)





0







(

mod


p

)







such that the determinant of the matrix of partial derivatives (∂Fi/∂Xj)(X1*, . . . , Xn*) is not divisible by p. Then there exists a unique solution (X1′, . . . , Xn′) of










F
1

(


X
1


,


,

X
n



)





0







(

mod



p

k
1



)







F
2

(


X
1


,


,

X
n



)





0







(

mod



p

k
2



)





















F
M

(


X
1


,


,

X
n



)





0







(

mod



p

k
m



)







such that (X1′, . . . , Xn′) modulo p is congruent to (X1*, . . . , Xn*).


Proof Let X=(X1, . . . , Xn) and DF(X) be the matrix of partial derivatives of F. If Σ is any n -dimensional vector of integers, then

F(X*+pΣ)=F(X*)+pDF(X*)·Σ (mod p2).  (100)


Since F(X*)≡0 (mod p), all components of the vector F(X*) are divisible by p, and so the following definition is allowed:

Σ=−DF(X*)−1 (F(X*)/p)

where the inverse matrix DF(X*)−1 is computed modulo p (by hypothesis, it is invertible).


Then (100) implies that F(X*+pΣ)≡0 (mod p2). Now iterate this construction with p2 instead of p, and so on. The iteration is none other than Newton's method:

Xn+1=Xn−DF(Xn)−1F(Xn)

and the same argument shows by induction that F(xn+1)≡0 (mod p2n+1).


For uniqueness, it is sufficient to exhibit a metric space for which the iteration Φ(X)=X−DF(X)−1F(X) is strictly contractive. To this end, let custom characterp denote the p-adic integers and extend Φ by density onto custom characterpn, where custom characterpn is given the finite-dimensional l metric. Then:

    • Φ(x) is contractive on the closed subset F(X)≡0 (mod p).


To prove it, suppose F(X),F(Y)≡0 (mod p). Denote by A the linear form such that DF(Y)−1=DF(X)−1+A(Y−X)+o(|Y−X|). Note that A is an integral form (i.e., has entries in custom characterp), because of the hypothesis on the determinant of DF(X). Then











ϕ

(
Y
)

-

ϕ

(
X
)


=



(

Y
-
X

)

+

(




DF

(
X
)


-
1




F

(
X
)


-



DF

(
Y
)


-
1




F

(
Y
)



)

+

o

(



"\[LeftBracketingBar]"


Y
-

X


"\[LeftBracketingBar]"




)








=



(

Y
-
X

)

+

(




DF

(
X
)


-
1




F

(
X
)


-


DF

(
X
)


-
1


+














A

(

Y
-
X

)

)



(


F

(
X
)

+


DF

(
X
)



(

Y
-
X

)



)


)

+

o

(



"\[LeftBracketingBar]"


Y
-

X


"\[LeftBracketingBar]"




)







=




A

(

Y
-
X

)



F

(
X
)


+


o

(



"\[LeftBracketingBar]"


Y
-

X


"\[LeftBracketingBar]"




)

.









Since F(X)≡0 (mod p), it then follows that |Φ(Y)−Φ(X)|≤p−1|Y−X|. Thus Φ is a strict contraction on a closed subset of a complete metric space, and therefore has a unique fixed point. □


Note that the proof of the theorem also contains an effective method for constructing the lifted solution (Newton's method).


Triangular Systems

A system of polynomials F1(X1), F2(X1, X2), . . . , Fn(X1, . . . , Xn), where the k-th polynomial of the system depends only on the first k variables, is called lower triangular. It is easier to formulate uniqueness for lower-triangular systems, and these are the only kinds of systems that shall be considered henceforth.


Theorem 13. Suppose that F1(X1), F2(X1, X2), . . . , Fn(X1, X2, . . . , Xn) is a lower-triangular system such that the diagonal partial derivatives ∞F1, ∞X1, ∞F2/∞X2, . . . , ∞Fn/∞Xn are non-zero constants modulo p. Then for any positive integers ki, there exists a unique solution to the system










F
1

(

X
1

)





0







(

mod



p

k
1



)







F
1

(


X
1

,

X
2


)





0







(

mod



p

k
2



)





















F
n

(


X
1

,

X
2

,


,

X
n


)





0







(

mod



p

k
n



)








such that 0≤Xi<pki for i=1, . . . n. Moreover, any two solutions Xi and Xi′ are congruent modulo pki.


Proof. The proof is by induction on the number of equations. The condition on ∞F1/ ∞X1 implies that F1 has the following form

F1(X1)=a1X1+b1+pR1(X1)

where R1 (X1) is an integral polynomial. By hypothesis, a1 is not zero modulo p, and so a1X1+b1≡0 (mod p) has a unique solution modulo p. Theorem 12 implies the uniqueness of the lift.


Assuming the theorem has been established for a lower triangular system F1(X1), . . . , Fn (X1, . . . , Xn) it is now sufficient to show how to prove it when there is one more relation Fn+1(X1, . . . , Xn+1). As in the n=1 case, the hypothesis implies

Fn+1(X1, . . . , Xn+1)=an+1Xn+1+bn+1+pRn+1(X1, . . . , Xn+1))

where an+1 is a nonzero constant and bn+1 is a polynomial in (X1, . . . , Xn), which have already been determined and so can be eliminated. Because an+1Xn+1+bn+1≡0 (mod p) has a unique solution for Xn+1, it therefore follows, again by Theorem 12, that the equation an+1Xn+1+bn+1+pRn+1≡0 (mod pkn+1) also has a unique solution. □


Polynomial Factorization

Suppose that f(x) is a polynomial of degree d≥1 modulo pM where p is prime and M≥1. Factorization of f has two phases. The second phase is known as Hensel lifting: given any factorization of f(x) modulo p, say f(x)≡f1(x)f2(x) . . . fr(x) (mod p), there exists a unique factorization of f(x) modulo pM, f(x)≡f1(x)f2(x) . . . fr(x) (mod pM) such that fi(x)≡fi(x) (mod p) for each i. Moreover, there exists a O ˜(dM) algorithm for determining the factors fi. Therefore, the problem of factoring modulo a prime power reduces to the problem of factoring modulo a prime.


Factorization Modulo a Prime

Factorization modulo an odd prime p is achieved with the following algorithm.


Input

A monic polynomial f(x) of degree d≥1, modulo an odd prime p.


Output

A set of pairs {(fi(x), ei)} of monic polynomials fi(x) that are irreducible mod p, and multiplicities ei, for 1≥i≥r, such that f(x)≡f1(x)e1f2e2 . . . fr(x)er.

    • 1. Initialize: Let h←x, ϕ←f, i←0, U←{ }.
    • 2. Let i←i+1
    • 3. By repeated squaring mod f, compute

      h←hp mod f.


Then set

g←gcd(h−x, ϕ)


4. If g≠1, then call the equal-degree factorization subroutine, with input g and i, and keep the list of irreducible factors g1, . . . , gs of g.

    • 5. For j=1 to s do:
      • Let e←0









While



g
j




"\[RightBracketingBar]"



ϕ


do


ϕ




ϕ

g
j




and


e



e
+
1.









      • U←U∪{(gj, e)}



    • 6. If ϕ≠1, then go to 2. Else return U.





Equal-Degree Factorization Subroutine

The following subroutine is used in the main algorithm.


Input

A square-free monic polynomial f modulo p of degree n>0, and a divisor d<n of n, such that all irreducible factors of f have degree d.


Output

The monic irreducible factors f mod p.

    • 1. If n=d, return {f}.
    • 2. Choose a polynomial a mod p with 1<degα<n.
    • 3. Let g1←gcd(a, f). If g1≠1, then call the algorithm recursively with g1 and f/g1, and return the union of the outputs of the two function calls. Else, go to 4.
    • 4. Compute b←a(pd−1)/2 mod f, by using repeated squaring modulo f, p.
    • 5. Let g2←gcd(b−1, f). If g2≠1 and g2≠f, then call the algorithm recursively with g2 and f/g2, and return the union of the outputs of the two function calls. Else go to 2.


Lifting to Higher Powers of p

Recall Hensel's lemma:


Theorem 14. Let p be a prime and f(x) be an integer polynomial admitting a factorization f(x)≡a(x)b(x) (mod p). Then, for any M≥1, there exist unique (p,M)-standard polynomials ã(x), {tilde over (b)}(x) with ã(x)≡a(x) (mod p) and b(x)≡b(x) (mod p) such that f(x)≡ã(x){tilde over (b)}(x) (mod pk).


The polynomials ã(x) and {tilde over (b)}(x) are called the lifts of the factors a(x) and b(x).


A corollary in the present application is:

    • Every persistent solution to

      r(x)s(x)≡v(x) (mod p)

      where r(x)=A(x)+U(x)−V(x), s(x)=A(x)−U(x)−V(x), lifts to a unique solution to

      r(x)s(x)≡v(x) (SP pk)

      where U(x) and V(x) are standard polynomials.


One Step of the Lift

For a factorization f=gh into a pair of factors, the lift is constructed using the following recursive procedure.


Inputs: A p-adic polynomial f and p-adic polynomials gk, hk, sk, tk such that

f≡gkhk (mod p2k)
skgk+tkhk≡1 (mod p2k).


Outputs: p-adic polynomials gk+1, hk+1, sk+1, tk+1 such that

f≡gkhk (mod p2k+1)
skgk+tkhk≡1 (mod p2k+1).

    • Let e←f−gkhk, and then ske←qhk+r using the division algorithm for polynomials.
    • Let hk+1←hk+r and gk+1←gk+tkek+qgk.
    • Let b←skgk+1+tkhk+1−1 and then skb←chk+1+d using the division algorithm for polynomials.
    • Let sk+1←sk−d and tk+1←tk−tkb−cgk+1.


Multifactor Lifting

To lift several factors, one employs a divide and conquer approach. Given a (pairwise coprime) factorization of f=g1g2 . . . gr:

    • If r is 1, there is nothing to do. Otherwise, divide the gi into two sets, and let (say) g be the product of the polynomials gi in the first set and h the product of the polyniomials hi in the second. For the factorizations g=Πigi and h=Πihi, recursively call the (multifactor) algorithm. Then, for f=gh call the algorithm of (12.4.4).


Polynomials Modulo a Prime
Polynomial Inversion

Let p be an odd prime and consider polynomials v(x)=α01x+ . . . +αnxn where the coefficients are integers 0≤αi<p for each i. The usual rules for polynomial arithmetic are observed, but the coefficients are reduced modulo p. The rules for arithmetic are then extended to power series modulo p. Operating on sequences, the rules are the same as those of digit sequences except that the carry is discarded. Thus the arithmetic of power series modulo p is arithmetic without carry.


Theorem 15. Let f(x) be a polynomial modulo p and suppose that p does not divide f(0). Then there exists a unique power series g(x) such that f(x)g(x)≡1 (mod p).


Proof. For uniqueness, if there were two solutions g and g′, then f(x)(g(x)−g′(x))≡0 (mod p) implies that g(x)−g′(x)≡0 (mod p) and so the polynomials g(x) and g′(x) are the same modulo p.


For existence, it will suffice to give an efficient algorithm for constructing the inverse. Since p does not divide f(0), the Euclidean algorithm gives a coefficient g0 modulo p such that

f(0)g0≡1 (mod p).


Then, for k=0,1, . . . , define

gk+1=(2−gkf)gk mod p2k+1.


Let |·| denote the x-adic norm on the power series:

|g(x)|=inf{2−k|xk|g(x)}.


Note that

|1−g0f|≤2−1   (101)

because x divides 1−g0f. It is now shown that also

|1−gk+1f|≤|1−gkf|2.  (102)


From (101) and (102) it follows by induction that

|1−gkf|≤2−2k

for all j; that is:

gkf≡1 (mod x2k).


Also, if k<k′, |gk−gk′|<2−2k, and it follows that gk and gk′, agree for the first 2k terms. Thus the series whose first 2k terms agree with gk is well-defined.


It remains to show that (102) holds. Consider










1
-


g

k
+
1



f


=

1
-

2


(

2
-


g
k


f


)



g
k


f








=


(

1
-


g
k


f


)

-


(

1
-


g
k


f


)



g
k


f








=



(

1
-


g
k


f


)

2

.








So (102) now follows by multiplicativity of the norm.□


Square Root

Theorem 16. Suppose that v(x) is a polynomial modulo p such that v(0) is a quadratic residue modulo p, say α2≡v(0) (mod p). Then there exists a unique power series A(x) mod p such that A(x)2≡v(x) (mod p) and A(0)≡α (mod p).


Proof. For uniqueness, if A, B are two solutions, then

A2−B2=(A−B)(A+B)≡0 (mod p).


Thus p divides either A−B or A+B, meaning that A≡±B (mod p). Hence, only one of A, B can satisfy A≡α (mod p). Therefore the solution is unique.


This leaves only the matter of existence. Define a sequence A0, A1, . . . by A0=α, and

Ak+1=2−1 (Ak+vAk−1) mod x2k+1  (103)

where the inverses are computed modulo x2k+1 using the algorithm of inversion modulo p.


Note that |v−A02|≤2−1. It shall be shown that

|v−Ak+12|=|v−Ak|2

so that, by induction,

|v−Ak2|p=2−2k,

i.e.,

Ak2≡v (mod x2k).

as desired.


To prove it, denote by 1/Ak the inverse of Ak modulo x2k+1. Then:










v
-

A

k
+
1

2





v
-


1
4



A
k
2


-


1
2


v

-


1
4



v
2



A
k

-
2



















1
2



(

v
-

A
k
2


)


+


1
4



(


A
k
2

-


v
2


A
k
2



)

















1
2



(

v
-

A
k
2


)


+


1
2




A

k
+
1



A
k




(


A
k

-

v

A
k



)

















1
2



(

v
-

A
k
2


)



(

1
-


A

k
+
1



A
k



)




(

mod



x

2

k
+
1




)

.












Next, note that







1
-


A

k
+
1



A
k






1
2




(


v
-

A
k
2



A
k


)

.






Substituting into the above now gives







v
-

A

k
+
1

2





1
4




(

v
-

A
k
2


)

2



A
k

-
1








and therefore, by multiplicativity of the norm and since |Ak|=1,

|v−Ak+12|=|v−Ak2|2,

as required. □


References, All of Which are Incorporated by Reference Herein





    • 1. Coraluppi, Giorgio, Method and apparatus for factoring large integers, U.S. Pat. No. 10,298,393, 21 May 2019.

    • 2. von zur Gathen, Joachim and Gerhard, Jürgen, Modern computer algebra, Cambridge University Press, 2013.

    • 3. C. F. Gauss, Disquisitiones Arithmeticae, New York, NY: Springer-Verlag, 1986.

    • 4. R. L. Rivest, A. Shamir, L. Adleman, A Method for Obtaining Digital Signatures and Public-Key Cryptosystems, Communications of the ACM, 21, 120-125, 1978.





Preferred Embodiment





    • An integer N0 to be factored is given. A prime p and vector of positive integers k=[k0, k1, . . . , kM−1] are selected. See FIG. 2.

    • A polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 is determined such that v(p)=N is a predetermined multiple of N0.

    • A pk-standard polynomial A(x) is determined such that A(x)2≡v(x) (SPpk).

    • A polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

      0≤fi<pki

      for i=0,1, . . . , M−1.

    • The “pk-standard part” of a polynomial f(x) is computed by reducing the coefficient of xi by pki, using the division algorithm.

    • The standard polynomial A(x) is determined by starting with the constant polynomial A0(x)=ω0 where ω0 is an integer such that ω02≡N0 (mod p), and then performing the iteration

      Aj+1(x)=2−1(Aj(x)+v(x)Aj(x)−1) (SPpk).

    • The roster of pairs (U(x), V(x)) is determined such that there is a persistent standard polynomial factorization:

      (A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

    • A standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p.

    • The persistent factorizations are determined by first factoring v(x) modulo p, and then lifting to a standard polynomial factorization.

    • The factorization of v(x) is achieved by first splitting factors by iterating, with repeated squaring, x→xp (mod v), using the division algorithm to compute the remainder on division by v, then computing the greatest common divisor using the Euclidean algorithm with xq−x and v(x). Then, with each of the factors so split, further splitting into factors of equal degree.
      • The Euclidean algorithm for inputs f and g is a procedure for determining their greatest common divisor. Exchange f and g if necessary so that degf≥degg. If g is the zero polynomial, return f. If f or g has degree 0, then the output is 1. Otherwise use the division algorithm to compute the remainder r of f on division by g, which will have degree less than that of g, and recursively call the Euclidean algorithm with inputs g, r.
      • Factors of a polynomial f of degree n that splits as a product of distinct polynomials all known to have the same degree d proceeds by starting with a random non-constant polynomial a of degree less than f, computing α(pd−1) (mod f) using the division algorithm and repeated squaring, using the Euclidean algorithm to test if αpd−1 −1 shares a factor with f. If so, then f splits and the algorithm is called recursively on the parts. If not, then a new (random) polynomial a is selected.

    • The lift is computed as follows. If v(x) factors modulo p as a product g0(x)h0(x), where g0, h0 share no common factor, then the extended Euclidean algorithm is employed to find polynomials s0(x), t0(x) modulo p such that s0(x)g(x)+t0(x)h(x)=1. For each integer j starting from 0 and increasing until the desired lift is obtained (for a pk-standard factorization), a polynomial is computed e=f−gjhj, then polynomials q, r are computed using the division algorithm so that sje=qhj+r. Let hj+1=hj+r and gj+1=gj+tjej+qgj. Then let b=sjgj+1+tjhj+1 and use the division algorithm to find c, d where sjb=chj+1+d. Then let sj+1=sj−d and tj+1=tj−tjb−cgj+1.

    • The extended Euclidean algorithm takes inputs a, b and produces (s, t, α) where sa+tb=a and a is the greatest common divisor of a, b. (1) Let α=α, β=b, S=1, T=0, s=0, t=1. (2) If β=0, then output (s, t, α). Use the division algorithm to find q, r such that degr<deβ and α=qβ+r. Let (S, s)=(s−qS, S) and (T, t)=(t−qT, T), α=β, β=r and go back to (2).

    • For each persistent standard polynomial factorization

      v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)

      the carry is determined by

      (A(p)−U(p)−V(p))(A(p)+U(p)−V(p))−v(p)≡BV(p)+C

      which defines constants B and C.

    • An integer a is computed using the division and extended Euclidean algorithms such that a=(B2/4+A(p)B) mod N0. (The extended Euclidean algorithm is necessary to invert 4 modulo N0.)

    • An initial point in a set of quartuples of integers modulo N0 (the projective space) is [X0, X1, X2, X3]=[1,0,CU(p) mod N0, 0], and the semigroup law is repeated starting from this point.

    • The semigroup law applies, given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, to produce a third point [Z0, Z1, Z2, Z3]:
      • It is tested whether [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0). If so, then the point [Z0, Z1, Z2, Z3] is













Z
0




16


X
0
4




X
2
4

(

mod



N
0


)









Z
1





X
0
4




X
2
2

(


4


X
3
2


-

1

6


C
2



U
2



X
0
2


a

-

3

2


C
2




U

(
p
)

2



X
0



X
1



)



(

mod



N
0


)










Z
2





-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

3

6


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

5

4


X
0



X
1
5


a

-








-
3


6


X
0
2



X
1
2



X
2
2


a

+

27


X
1
6


-

3

6


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)






(

mod



N
0


)








Z
3






(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2



(

mod



N
0


)











    • Otherwise, the point [Z0, Z1, Z2, Z3] is:













Z
0






(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2




Y
0
2

(

mod



N
0


)









Z
1





X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


C
2




U

(
p
)

2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)



(

mod



N
0


)









Z
2





X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



C
2




U

(
p
)

2



X
0



X
2



Y
0
2


+

4


C
2




U

(
p
)

2



X
0
2



Y
0



Y
2


+








+

X
1




X
3



Y
0



Y
2


+

3


X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-








-

X
0




X
2



Y
1



Y
3


-

2


a

(






X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-








-

X
0




X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3






)






)



(

mod



N
0


)









Z
3






(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








-

X
0
2




X
1



Y
0



Y
1
2


+


X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2



(

mod



N
0


)











    • The semigroup law is repeated, possibly in batches to minimize the number of arithmetic operations performed. There is a test if the semigroup reaches the boundary of the projective space; when it does so, a factorization of N0 is achieved.

    • If a factorization of N0 is not achieved after a preselected amount of time, a different multiple of N0 shall be selected in lieu of N, and the process is repeated until a factor is found.





DESCRIPTION OF THE INVENTION

The present invention pertains to a method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers. See FIGS. 1-4. The method comprises the steps of obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory. There is the step of storing the signal W in a second non-transient memory. There is the step of decoding with a second computer in communication with the second non -transient memory the signal W in the second non-transient memory by factoring the public key N0 in at most a time O(log6N0) with the second computer generated steps of selecting integers a, b. There is the step of electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0]. There is the step of applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3]. There is the step of determining that [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is










Z
0




16


X
0
4




X
2
4

(

mod



N
0


)









Z
1





X
0
4




X
2
2

(


4


X
3
2


-

1

6


b
2



X
0
2


a

-

3

2


b
2



X
0



X
1



)



(

mod



N
0


)









Z
2





-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

3

6


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

5

4


X
0



X
1
5


a

-








-
3


6


X
0
2



X
1
2



X
2
2


a

+

2

7


X
1
6


-

3

6


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)



(

mod



N
0


)










Z
3






(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2



(

mod



N
0


)



;








otherwise, the point [Z0, Z1, Z2, Z3] is:










Z
0






(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2




Y
0
2

(

mod



N
0


)









Z
1





X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


b
2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)



(

mod



N
0


)









Z
2





X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



b
2



X
0



X
2



Y
0
2


+

4


b
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+








+
3



X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-







-
2



a

(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)



(

mod



N
0


)









Z
3






(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








-

X
0
2




X
1



Y
0



Y
1
2


+


X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2




(

mod



N
0


)

.









There is the step of testing if any component of the third point shares a factor with N0 and is a shared factor with N0. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


There may be the step of displaying on a display the decrypted signal W. The display may be any type of computer display, tablet display, telephone display or paper which allows the decrypted signal W to be read by a person.


There may be the steps of, if a factorization of N0 is not found after a preselected amount of time, re-initializing the semigroup law with different values of a and b; and repeating the electing, applying, determining, testing and Identifying steps until a factor with N0 is found.


There may be the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There may be the step of determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There may be the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pki and truncating all terms xm for m≥M. There may be the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p.


There may be the second computer generated steps of for each item of the roster, a standard polynomial factorization is

v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)

determining a carry by

(A(p)−U(p)−V(p))(A(p)+U(p)−V(p))−v(p)≡BV(p)+C

which defines constants B and C for each pair of the roster, for those elements of the roster of (U(x), V(x)) such that both corresponding constants B, C are simultaneously zero, the integers r(p)=A(p)−U(p)−V(p) and s(p)=A(p)+U(p)−V(p) contain divisors of N0. There may be the step of extracting the divisors to obtain the prime factors of N0.


The present invention pertains to a second computer for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s, as shown in FIG. 1 and FIG. 3. The second computer comprises an input for obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory, a second non -transient memory in communication with the input in which the signal W is stored. The second computer comprises a cpu in communication with the second non-transient memory with the signal W in the second non-transient memory that decodes the signal W by factoring the public key N0 in time O(log6N0) by the second computer generated steps of selecting integers a, b. There is the step of electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0]. There is the step of applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3]. There is the step of determining that [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is










Z
0




16


X
0
4




X
2
4

(

mod



N
0


)









Z
1





X
0
4




X
2
2

(


4


X
3
2


-

16


b
2



X
0
2


a

-

3

2


b
2



X
0



X
1



)



(

mod



N
0


)









Z
2





-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

36


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

54


X
0



X
1
5


a

-








-
36



X
0
2



X
1
2



X
2
2


a

+

27


X
1
6


-

36


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)



(

mod



N
0


)










Z
3






(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2



(

mod



N
0


)



;







otherwise, the point [Z0, Z1, Z2, Z3] is:










Z
0






(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2




Y
0
2

(

mod



N
0


)









Z
1





X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


b
2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)



(

mod



N
0


)









Z
2





X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



b
2



X
0



X
2



Y
0
2


+

4


b
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+








+
3



X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-







-
2



a

(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)



(

mod



N
0


)









Z
3






(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








-

X
0
2




X
1



Y
0



Y
1
2


+


X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2




(

mod



N
0


)

.









There is the step of testing if any component of the third point shares a factor with N0 and is a shared factor with N0. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. The cpu decrypting the signal W with the public key N0 and prime factors of integer N0. The cpu reviewing the decrypted signal W for predetermined words to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be quickly acted upon to eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated. The steps described above for the method are also applicable to the second computer.


The present invention pertains to a non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s, where the signal W has been stored in a second non-transient memory of a second computer, and the second computer factoring the public key N0 in time O(log6N0). The signal W obtained from a telecommunications network, or a data network or an Internet or a first non-transient memory. The computer program having the second computer generated steps of selecting integers a, b. There is the step of electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0]. There is the step of applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3]. There is the step of determining that [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is










Z
0




16


X
0
4




X
2
4

(

mod



N
0


)









Z
1





X
0
4




X
2
2

(


4


X
3
2


-

16


b
2



X
0
2


a

-

3

2


b
2



X
0



X
1



)



(

mod



N
0


)









Z
2





-
2



X
0




X
2

(





8


X
0
3



X
1
3



a
3


+

36


X
0
2



X
1
4



a
2


-

8


X
0
3



X
1



X
2
2



a
2


+

54


X
0



X
1
5


a

-








-
36



X
0
2



X
1
2



X
2
2


a

+

27


X
1
6


-

36


X
0



X
1
3



X
2
2


+

8


X
0
2



X
2
4






)



(

mod



N
0


)










Z
3






(


4


X
0
2



X
1
2



a
2


+

1

2


X
0



X
1
3


a

-

4


X
0
2



X
2
2


a

+

9


X
1
4


-

8


X
0



X
1



X
2
2



)

2



(

mod



N
0


)



;







otherwise, the point [Z0, Z1, Z2, Z3] is:










Z
0






(



X
1



Y
0


-


X
0



Y
1



)

4



X
0
2




Y
0
2

(

mod



N
0


)









Z
1





X
0
3





Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)

2



(


2


b
2



X
0



Y
0


+

2


X
1



Y
1


a

+


X
3



Y
1


-

2


X
2



Y
2


+


X
1



Y
3



)



(

mod



N
0


)









Z
2





X
0
3




Y
0
3

(



X
1



Y
0


-


X
0



Y
1



)



(






-
4



b
2



X
0



X
2



Y
0
2


+

4


b
2



X
0
2



Y
0



Y
2


+


X
1



X
3



Y
0



Y
2


+








+
3



X
0



X
3



Y
1



Y
2


-

3


X
1



X
2



Y
0



Y
3


-


X
0



X
2



Y
1



Y
3


-







-
2



a

(



X
1



X
2



Y
0



Y
1


-


X
0



X
3



Y
0



Y
2


-


X
0



X
1



Y
1



Y
2


+


X
0



X
2



Y
0



Y
3



)





)



(

mod



N
0


)









Z
3






(







(



X
1



Y
0


-


X
0



Y
1



)

2



X
0



Y
0


a

+


X
1
3



Y
0
3


-


X
0



X
2
2



Y
0
3


-


X
0



X
1
2



Y
0
2



Y
1


-








-

X
0
2




X
1



Y
0



Y
1
2


+


X
0
3



Y
1
3


+

2


X
0
2



X
2



Y
0
2



Y
2


-


X
0
3



Y
0



Y
2
2






)

2




(

mod



N
0


)

.









There is the step of testing if any component of the third point shares a factor with N0 and is a shared factor with N0. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated. The steps described above for the method are also applicable for the computer program.


Alternatively, the present invention pertains to a method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers. The method comprises the steps of obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non -transient memory. There is the step of storing the signal W in a second non-transient memory. There is the step of decoding with a second computer in communication with the second non-transient memory the signal W in the second non-transient memory by factoring the public key N0 in at most a time O(log6N0) with the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There is the step of determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There is the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pki and truncating all terms xm for m≥M. There is the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p. There is the step of determining a shared factor that integers r(p) and s(p) share with N0, where the shared factor with N0 as one of plurality of prime factors of N0. There is the step of obtaining another prime factor by division of N0 by the shared factor. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated.


There may be the second computer generated steps of, for each item of the roster, a standard polynomial factorization is

v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)

then determining a carry by

(A(p)−U(p)−V(p))(A(p)+U(p)−V(p))−v(p)=BV(p)+C

which defines constants B and C for each pair of the roster, for those elements of the roster of (U(x), V(x)) such that both corresponding constants B, C are simultaneously zero, the integers r(p)=A(p)−U(p)−V(p) and s(p)=A(p) +U(p)−V(p) contain divisors of N0. There may be the step of extracting the divisors to obtain the prime factors of N0.


There may be the second computer generated steps of given the initial pair ξ1=0, y1=CU(p) mod N0, calculating a discriminant Δ from









Δ
=


x
3

+


(



B
2

4

+

A


(
p
)


B


)



x
2


+



U

(
p
)

2



C
2







mod




N
0

.








There may be the step of iterating a semigroup law until a factor is found, where the semigroup law is defined as:


If ξn≡ξ1 (mod N0), let δ=ξ1, σ1=0, σn=1, otherwise, ξn . . . ξ1 is a nonzero constant modulo N0; checking whether ξn−ξ1 shares a factor with N0; if so, then terminating the semigroup iteration and the factor identified is one of the prime factors of N0, where the other prime factor is found by division of N0 by the first factor; let δ=1, λ=(ξn−ξ1)−1 (mod N0), σ1=−λ, σ2=λ; so irrespective of whether ξn≡ξ1 (mod N0), it holds that σ1ξ1nξn=δ where δ is a polynomial gcd of ξ1 and ξn;


Next, if yn≡−y1 (mod N0), then let d=δ, ρ=1, ϵ=0; else, checking if yn+y1 shares a factor with N0 and if so then terminating the semigroup iteration and the first factor identified as one of the prime factors of N0, where the other prime factor is found by division of N0 by the first factor; otherwise, let d=1, ρ=0, and λ=(yn+y1)−1 mod N0, so that for either sign in yn≡±y1 (mod N0), a congruence ρδ+ϵ(y1+yn)≡d (mod N0) now holds, where d is a polynomial gcd of δ and y1+yn;


Finally, let ξn+1←ξnξ1/d2, define yn+1 (mod N0) such that the congruence holds:

dyn+1≡ρ(σ1ξ1ynnξny1)+ϵδ(mod ξn+1)

where the modulo is with respect to polynomial division by ξn+1 (mod N0), and, if ξn+1 is quadratic rather than linear, then let







ξ

n
+
1






Δ
-

y

n
+
1

2



ξ

n
+
1



.





There may then be the step of testing whether the leading coefficient of ξn+1 and N0 share a factor, and if so, then terminating the semigroup iteration and the first factor is found by division of N0 by the first factor; else, normalize ξn+1 by dividing (modulo N0) by the leading coefficient of ξn+1 and update yn+1:

yn+1←−yn+1 mod ξn+1.


There may be the step of iterating the semigroup law until a prime factor is found. There may be the step of identifying this prime factor as the first factor of N0. There may be the step of obtaining the other prime factor by division of N0 by the first prime factor.


The present invention pertains to a second computer for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s. The second computer comprises an input for obtaining the electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory. The second computer comprises a second non-transient memory in communication with the input in which the signal W is stored. The second computer comprises a cpu in communication with the second non -transient memory with the signal W in the second non-transient memory. The cpu decodes the signal W by factoring the public key N0 in time O(log6N0) by the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There is the step of determining a polynomial v(x)=v0+v1x+ , , , +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There is the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pki and truncating all terms xm for m≥M. There is the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p. There is the step of determining a shared factor that integers r(p) and s(p) share with N0, where the shared factor with N0 as one of plurality of prime factors of N0. There is the step of obtaining another prime factor by division of N0 by the shared factor. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. The cpu decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. The cpu reviewing the decrypted signal W for predetermined words to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated. The steps described above for the alternative method are also applicable for the second computer.


The present invention pertains to a non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers and W is a function of r and s, where the signal W has been stored in a second non-transient memory of a second computer, and the second computer factoring the public key N0 in at most a time O(log6N0). The signal W obtained from a telecommunications network, or a data network or an Internet or a first non-transient memory. The computer program having the second computer generated steps of: selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]. There is the step of determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0. There is the step of determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if

0≤fi<pki

for i=0,1, . . . ,M−1, a pk-standard part of the polynomial f(x) is computed by reducing the coefficient of xi modulo pki and truncating all terms xm for m≥M. There is the step of determining a roster of pairs (U(x), V(x)) such that there is a persistent standard polynomial factorization:

(A(x)−U(x)−V(x))(A(x)+U(x)−V(x))≡v(x) (SPpk)

where a standard polynomial factorization v(x)≡r(x)s(x) is called persistent if r(x) and s(x) have the same degree as their reductions modulo p. There is the step of determining a shared factor that integers r(p) and s(p) share with N0, where the shared factor with N0 as one of plurality of prime factors of N0. There is the step of obtaining another prime factor by division of N0 by the shared factor. There is the step of identifying the shared factor with N0 as one of plurality of prime factors of N0, and a quotient of N0 by the shared factor as another prime factor. There is the step of decrypting with the second computer the signal W with the public key N0 and prime factors of the integer N0. There is the step of reviewing the decrypted signal W for predetermined words with the second computer to determine if the decrypted signal W indicates an act has occurred or will occur that violates a law, or will violate a law, wherein the signal W representative of the message is effectively decrypted and deciphered thereby a threat to property or individuals in violation of the law can be acted upon to mitigate or eliminate the threat before the threat occurs and actual damage to property or injury to individuals is prevented or mitigated. The steps described above for the alternative method are also applicable for the computer program.


Although the invention has been described in detail in the foregoing embodiments for the purpose of illustration, it is to be understood that such detail is solely for that purpose and that variations can be made therein by those skilled in the art without departing from the spirit and scope of the invention except as it may be described by the following claims.

Claims
  • 1. A method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers comprising the steps of: obtaining an electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory;storing the electromagnetic signal W in a second non-transient memory;decoding with a second computer in communication with the second non-transient memory the electromagnetic signal W in the second non-transient memory by factoring the public key N0 in at most a time O(log6N0) with the second computer generated steps of selecting integers a, b;electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0];applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3];determining that [X0: X1: X2: X3]≡[Y0: Y1: Y2: Y3] (mod N0), and thus the third point is
  • 2. The method of claim 1 including the steps of if a factorization of N0 is not found after a preselected amount of time, re-initializing the semigroup law with different values of a and b; and repeating the electing, applying, determining, testing and Identifying steps until a factor with N0 is found.
  • 3. The method of claim 2 including the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]; Determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0;Determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if 0≤fi<pki
  • 4. The method of claim 3 including the second computer generated steps of for each item of the roster, a standard polynomial factorization is v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)
  • 5. A non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers, where the electromagnetic signal W has been stored in a second non-transient memory of a second computer, and the second computer factoring the public key N0 in time O(log6N0), the electromagnetic signal W obtained from a telecommunications network, or a data network or an Internet or a first non-transient memory, the computer program having the second computer generated steps of: selecting Integers a, b; electing an initial point in a set of quartuples of integers modulo N0 (a projective space) [X0, X1, X2, X3]=[1,0,b,0];applying a semigroup law repeatedly starting from the initial point, where the semigroup law is defined as: given a pair of elements [X0: X1: X2: X3] and [Y0: Y1: Y2: Y3] of the projective space, there is produced a third point [Z0, Z1, Z2, Z3];
  • 6. The non-transitory readable storage medium of claim 5 wherein the software program includes the second computer generated steps of if a factorization of N0 is not found after a preselected amount of time, re-initializing the semigroup law with different values of a and b; and repeating the electing, applying, determining, testing and Identifying steps until a factor with N0 is found.
  • 7. The non-transitory readable storage medium of claim 6 wherein the software program includes the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]; determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0;determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where apolynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if 0≤fi<pki
  • 8. The non-transitory readable storage medium of claim 7 wherein the computer program includes the second computer generated steps of for each item of the roster, a standard polynomial factorization is v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)
  • 9. A method for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers comprising the steps of: obtaining an electromagnetic signal W from a telecommunications network, or a data network or an Internet or a first non-transient memory;storing the electromagnetic signal W in a second non-transient memory;decoding with a second computer in communication with the second non-transient memory the electromagnetic signal W in the second non-transient memory by factoring the public key N0 in at most a time O(log6N0) with the second computer generated steps of selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1];determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0;determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where apolynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if 0≤fi<pki
  • 10. The method of claim 9 including the second computer generated steps of for each item of the roster, a standard polynomial factorization is v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)
  • 11. The method of claim 10 including the second computer generated steps of given the initial pair ξ1=0, y1=CU(p) mod N0, calculating a discriminant Δ from
  • 12. A non-transitory readable storage medium which includes a computer program stored on the storage medium for decoding an encrypted electromagnetic signal W encoded by a first computer with public key N0=r×s, where N0, r and s are integers, where the electromagnetic signal W has been stored in a second non-transient memory of a second computer, and the second computer factoring the public key N0 in time O(log6N0), the electromagnetic signal W obtained from a telecommunications network, or a data network or an Internet or a first non-transient memory, the computer program having the second computer generated steps of: selecting a prime p and vector of positive integers k=[k0, k1, . . . , kM−1]; determining a polynomial v(x)=v0+v1x+ . . . +vn−1xn−1 such that v(p)=N is a predetermined multiple of N0;determining a pk-standard polynomial A(x) such that A(x)2≡v(x) (SPpk), where a polynomial f(x)=f0+f1x+f2x2+ . . . +fM−1xM−1 is called pk-standard if 0≤fi<pki
  • 13. The non-transitory readable storage medium of claim 12 wherein the computer program including the second computer generated steps of for each item of the roster, a standard polynomial factorization is v(x)≡(A(x)−U(x)−V(x))(A(x)+U(x)−V(x)) (SP)
  • 14. The non-transitory readable storage medium of claim 13 wherein the computer program including the second computer generated steps of given the initial pair ξ1=0, y1=CU(p) mod N0, calculating a discriminant Δ from
US Referenced Citations (2)
Number Name Date Kind
20130136257 You May 2013 A1
20180198613 Anderson Jul 2018 A1