Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
It can be verified that
For this challenge you are given , , , where and
where represents triangular numbers, represents pentagonal numbers and is hexagonal. It can be observed that all hexagonal numbers are triangular numbers so we'll handle only 2 kinds of queries as
, find all numbers below N which are Triangular number as well as Pentagonal
, find all numbers below N which are Pentagonal number as well as Hexagonal
Input contains three integers
Print the answer corresponding to the test case. Print numbers in ascending oder.