Problem 52859. Easy Sequences 35: Cutting a donut to Semi-prime pieces
something weird happens in this series...
Many more numbers pop up as part of the solution.
330290 ## 463 * 12970537638763 = 6005358926747269
330321 ## 165161 * 36370874563 = 6007050013699643
330326 ## 2678131 * 2243102671 = 6007322799387901
These 3 examples are semi-primes.
You can check in MATLAB command window:
factor( C(330290) )
factor( C(330321) )
factor( C(330326) )
where C(n) is the equation for the cuts-pieces on a torus.
For this reason, the test 6 of this problem may be wrong and should updated for x=3e5.
Actually, factor(C(330290)) would return:
[ 2 5 23 29 33029 27259489]
without rounding errors.
Flintmax ~ 9e15, so if you calculated ~6e15 as n/6, n was clearly above flintmax.
A key point to solve this quickly for large inputs is to notice that any prime factors of n other than 2 or 3 will necessarily be factors of C(n) because the polynomial has a zero constant term.
thank you for pointing out a crucial detail that I was missing!
Problem Recent Solvers6
How many trades represent all the profit?
More from this Author104
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!