GGK interview question

Program on number patterns.