09-22-2024, 12:30 AM
I guess the way I'd have to do such large numbers would be with string math, and then I'd cross my fingers and hope that some of the simplest tricks to math helped reduce those figures down as much as possible.
Is it an even number? End in 2/4/6/8/0? That can be halved and hopefully reduce the work load before you get into the hard crunch.
Can you add up the sum of the digits and evenly divide them by 3?
Does it end in 5?
Three quick and easy tests that you can do without having to worry much about string math, and it resolves a whole boat load of possibilities for you right off the bat. (you simplify all numbers that end with 2/4/5/6/8/0 down really quickly, along with any divisible by 3.)
After that, it's just string math and let it grind until there's no grinding left to do. Hopefully, you have a nice list of primes to go by for as much of that math as possible. After you use up your predefined stuff, the rest is just calculating every value that remains and then it REALLY bogs down in performance.
Is it an even number? End in 2/4/6/8/0? That can be halved and hopefully reduce the work load before you get into the hard crunch.
Can you add up the sum of the digits and evenly divide them by 3?
Does it end in 5?
Three quick and easy tests that you can do without having to worry much about string math, and it resolves a whole boat load of possibilities for you right off the bat. (you simplify all numbers that end with 2/4/5/6/8/0 down really quickly, along with any divisible by 3.)
After that, it's just string math and let it grind until there's no grinding left to do. Hopefully, you have a nice list of primes to go by for as much of that math as possible. After you use up your predefined stuff, the rest is just calculating every value that remains and then it REALLY bogs down in performance.