Problem 52859. Easy Sequences 35: Cutting a donut to Semi-prime pieces
Solution Stats
Problem Comments
-
3 Comments
For n>330289
something weird happens in this series...
Many more numbers pop up as part of the solution.
For example:
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.
@GeeTwo
thank you for pointing out a crucial detail that I was missing!
Solution Comments
Show commentsProblem Recent Solvers6
Suggested Problems
-
Number of 1s in the Binary Representation of a Number
444 Solvers
-
114 Solvers
-
Return elements unique to either input
770 Solvers
-
118 Solvers
-
Is this triangle right-angled?
5805 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!