Problem 60950. Find the longest runs of primes generated by polynomials
- Take the absolute value of the output of the polynomial. For example, consider -11, -13, -19, etc. to be prime for this problem, even though negative numbers are not strictly considered to be prime.
- Round the absolute value to the nearest integer. Although this step is not necessary when the coefficients of the polynomial are integers, it can be necessary when they are not, as in the last two tests.
- Make sure to list only the primes in the longest run. The polynomials will produce other primes outside of the longest run, but do not include them in the output.
Solution Stats
Problem Comments
-
3 Comments
This is an interesting and nice problem, Chris. Difficulty is of course how to know a run is the longest !
Thanks Nicolas. I added a link to the MathWorld page that listed the polynomials in the test. Perhaps I misinterpreted that page as giving the longest runs. For the example in the description, every value of n divisible by 11 will give a composite number, so the runs can be no longer than 11 terms. Similar arguments apply to at least some of the other examples, though I haven't worked out all of them.
Cool problem. I wonder if there are any polynomials where the longest run of primes does not begin at an input of x=0? It would make the problem a little more difficult.
Solution Comments
Show commentsProblem Recent Solvers4
Suggested Problems
More from this Author310
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!