Imagine some cube which we can cut into smaller cubes without remaining pieces.
Find to how many cubes a cube can be cut.
For example, a cube can be cut into 8, 27 (obviously 3rd powers of integers) and 20 (19 small cubes plus one eight times the size of the others, see image).
See here some help: http://mathworld.wolfram.com/CubeDissection.html
Program should take as input integer n
(0 <= n <= 1 000
) and print all numbers less or equal to n
so that a cube can be cut into that number of cubes.
Suppose that cube can be cut into 1 cube and cannot into 0 cubes.
You can use only integral data-types (no arrays, objects etc) of size no greater than 64-bits. Shortest code wins.