Prime permutations
This problem is simple, but my old code is ugly. But it only take 1.6ms. So I kindly forgave myself. Not too much can be learned from this problem.
Update(06/28/2017):
Actually, my old code was inefficient since I used the stl function next_permutation to generate all arithmetic progression sequence. I can combine all the prime numbers that are made from the same group of digits into a vector and check if any arithmetic progression sequence can be created from them, which is more efficient.
No comments:
Post a Comment