Here's simpler solution to codeforces round 191(div 2) ,question hungry sequence- https://codeforces.net/contest/327/problem/B Suppose we are given the number N. We can observe that for any N ,number divisible by N is always greater than or equal to 2*N, so we select numbers N+0,N+1,N+2,.......N+N-1 .So, Here we N satisfying conditions of hungry sequence.