Problem 2342. Numbers spiral diagonals (Part 2)
Solution Stats
Problem Comments
-
4 Comments
Interesting problem! If I'm not mistaken, your description of the problem is not entirely accurate, however. For n = 1, the spiral matrix is just [ 1 ], for which the share of primes on the main diagonals is zero, below any given 0 < p < 1; so strictly speaking the correct answer to the problem as posed would be 1 for any p.
Nice observation, @Christian!
I have edited the question statement, it (now) asks for an odd integer greater than 1.
This is a seriously good problem. Love it! You will have to optimize your code in order for the tests to not time out.
bài này nên lên mạng để tìm hiểu quy luật của các số tại các đường chéo rồi từ đó mới quay vào phần tính xác suất
Solution Comments
Show commentsProblem Recent Solvers192
Suggested Problems
-
Reverse the Words (not letters) of a String
470 Solvers
-
Longest run of consecutive numbers
6408 Solvers
-
Calculate the area of a triangle between three points
3400 Solvers
-
606 Solvers
-
Fix the last element of a cell array
1736 Solvers
More from this Author43
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!