Wipro Interview Question

Find gcd of no and pattern