\ Art Hampton's Ramanujan's cube program of 10/8/93 \ transcribed into TF83 by VHV, 8/29/05 2VARIABLE pair1 2VARIABLE sum1 : prcubed ( --) ." cubed " ; : cubed ( n -- D) DUP DUP * UM* ; : testcubes ( --) pair1 2@ 7 + \ magic loop arguments DO I cubed pair1 2@ DROP I \ yet again magic! DO 2DUP I cubed D+ sum1 2@ D= IF CR pair1 2@ 2 U.R prcubed ." + " 2 U.R prcubed ." = " I 2 U.R prcubed ." + " J 2 U.R prcubed ." = " sum1 2@ 5 UD.R LEAVE THEN LOOP 2DROP LOOP ; : sumcubes ( --) DARK 18 1 \ magic numbers found by testing DO I pair1 ! \ save the first integer I cubed \ the first integer cubed 41 I 11 + \ more magic loop arguments DO I pair1 2+ ! \ save the second integer 2DUP I cubed D+ \ the sum of the cubes of the first pr sum1 2! \ to pass into variable is easier than on the stack testcubes LOOP 2DROP LOOP CR ;