Calculate to how many cubes one cube can be cut 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 &lt;= n &lt;= 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.
Mathematica, 62 bytes (or 52)

It's hardcoded answer, nothing interesting.


  If[EvenQ@BitShiftRight[164015534735101,n],Print@n]~Do~{n,1000}


This one is 52 bytes long but violates my rules - it uses large integers (powers of 2) and lists (Range).


  Select[Range@1000,EvenQ@Floor[164015534735101/2^#]&amp;]