Details and Options
Given positive integers
a,b such that
a>b and a semiprime
N, we may compute a factor,
q, of
N by creating the sequence
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/708e25f86b7670b8.png)
where
Q0=N. The sequence terminates if
Qk<2, in which case the method has failed for the
a/b-rational base representation. Otherwise, the sequence terminates if
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/411e7f84fdb361ae.png)
, in which case we have found a factor,
q, of
N.
Similar to Fermat's factorisation algorithm, which factors
N=p q quickly when
p is close to
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/7bd21540112bd289.png)
,
ResourceFunction["FactorSemiprime"] will factor
N=p q quickly when
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/1885a5f575d08fec.png)
, with
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/4e6f48401771b8c1.png)
and
a,b are exhaustively searchable.
Similar to trial division, which tests successive odd integers for divisibility, ResourceFunction["FactorSemiprime"] exhaustively tests each possible a/b-rational base representation of p in lexicographic order. That is, a/b=2,3,4,3/2,5,6,5/2,4/3,7,5/3,…
However, unlike trial division, for a single
a/b, if
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/4e6f48401771b8c1.png)
, then
ResourceFunction["FactorSemiprime"] will obtain the factor
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/176b8a65c4f8b4db.png)
, for all
c∈ℕ and for all
Δ∈ℕ such that
![](https://www.wolframcloud.com/obj/resourcesystem/images/d1b/d1b9a471-38b3-4f13-9efe-da5c7a75aa35/0a84537066da387e.png)
.
Much like other existing algorithms for integer factorisation, it is exceedingly unlikely that ResourceFunction["FactorSemiprime"] will quickly factor an arbitrary, large semiprime.