1 questions from the last 7 days
-2
votes
0
answers
79
views
How'd you make algorithm that'll find shortest way to sort sequence of numbers just by applying function f(x) that will make x to closest lower prime? [closed]
Imagine you get sequence of integers:
[a1 a2 a3 ... an]
where:
1 <= a <= 10^6
1 <= n <= 10^6
You are given a function f(x) that can change a number to the closest lower prime number, or ...