Math |
public static IEnumerable<BigInteger> FactorNaive( BigInteger n )
This code was created as an experiment in early 2021 while playing around with Carmichael numbers and Fermat's Little Theorem. I was so shocked by the high-speed performance of the BigInteger class that I decided it was worth saving this code as a reference.
As the Blog Post explains, the naïve factoring loop works surprisingly fast up until about 1018 after which it hits the exponential wall and quickly becomes impractical.