Problem Link :http://www.usaco.org/index.php?page=viewproblem2&cpid=1043 My approach was let we will store the K in vector for Each i [1...N] now let say n+1 can be represented as sum of x+y i:e n+1= x+y so answer will be set[n]=Lcm of (Set[x],Set[y]) for every unique pair of x,y but this solution is not working can anyone give correct solution