You are viewing a single comment's thread. Return to all comments →
There is an alternative solution, but not so efficient (but still O(1) in spite of recursion) and not so elegant as the Diophantine equation. This is linear congruence equation: 5x = n (mod 3). You can solve it by means of the extended Euclidean algorithm. I am aware that this is like 'A sledgehammer to crack a nut', but fyi. Here you can practise with the linear congruence.
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
There is an alternative solution, but not so efficient (but still O(1) in spite of recursion) and not so elegant as the Diophantine equation. This is linear congruence equation: 5x = n (mod 3). You can solve it by means of the extended Euclidean algorithm. I am aware that this is like 'A sledgehammer to crack a nut', but fyi. Here you can practise with the linear congruence.