Problem 659. How long is the longest prime diagonal?
Stanislaw Ulam once observed that if the counting numbers are arranged in a spiral, the prime numbers contained in it form a surprising pattern. They appear to cluster along diagonals of the spiral matrix.
Given n, return the length of the longest diagonal sequence of primes in spiral(n).
Since isprime(spiral(n)) is
Solution CommentsShow comments
Problem Recent Solvers385