Good, though your solution is still not THAT slower then Greg's: C:\eclipse\workspace\quizes\other>fold_luke.rb Each operation will run 1000 times. 2x2 sheet folding done in 0.2 seconds 4x4 sheet folding done in 0.491 seconds 8x8 sheet folding done in 1.282 seconds 16x16 sheet folding done in 3.915 seconds C:\eclipse\workspace\quizes\other>fold_greg.rb Each operation will run 1000 times. 2x2 sheet folding done in 0.381 seconds 4x4 sheet folding done in 0.581 seconds 8x8 sheet folding done in 1.071 seconds 16x16 sheet folding done in 2.744 seconds PS: I tried using memoize library to evaluate the performance boost, and the results are quite interesting: (with memoize) Each operation will run 1000 times. 2x2 sheet folding done in 0.02 seconds 4x4 sheet folding done in 0.01 seconds 8x8 sheet folding done in 0.02 seconds 16x16 sheet folding done in 0.03 seconds 32x32 sheet folding done in 0.04 seconds 64x64 sheet folding done in 0.1 seconds 128x128 sheet folding done in 0.341 seconds 256x256 sheet folding done in 1.372 seconds (without) Each operation will run 1000 times. 2x2 sheet folding done in 0.241 seconds 4x4 sheet folding done in 0.56 seconds 8x8 sheet folding done in 1.703 seconds 16x16 sheet folding done in 5.818 seconds (didn't go further, the things are already clear enough)