Hello everyone,, While solving recently, I wanted to compute:gcd({lcm({ai,aj}) | i<j}) from the problem named Orac and LCM(link:https://mirror.codeforces.com/problemset/problem/1349/A).
Normally, We would just write two nested loops. But for fun and practice, I tried to implement it using double recursion – one recursion for the outer loop, and one recursion for the inner loop. This is of course not the most efficient solution for very large n (n<=100,000), but I found it to be a neat way of understanding how recursion can simulate loops,
If anyone has their own ideas, optimizations, or different recursive approaches, I would be very happy to learn from you. Please feel free to share your thoughts in the comments. Thanks in advance.
my submission:https://mirror.codeforces.com/contest/1349/submission/334634088







