C Try to understand  why x^3+y^3=n!
C has only one solution x=y=1,
C get idea for proof
C Hugo Pfoertner, http://www.pfoertner.org
C Input from Richard Guy used
C
      IMPLICIT INTEGER (A-Z)
C
C LOOPS OVER X AND Y
      DO 10 X = 1, 20
      X2 = X * X
      X3 = X2 * X
C
      DO 20 Y = 1, X-1
      Y2 = Y * Y
      Y3 = Y2 * Y
C X^3+Y^3 = (X+Y)*(X^2-X*Y+Y^2) = YPY*PAR = SUM
      XPY = X + Y
      PAR = X2 - X*Y + Y2
      SUM = X3 + Y3
      WRITE (*,1000) X, Y, XPY, PAR, SUM
1000  FORMAT ( I3, '^3+', I2, '^3=', I2, '*(', I3, ')=', I5 )
C
C TRY IF PAR IS OF THE FORM 6*K+1
C
      IF ( MOD ( PAR-1,6 ) .EQ. 0 ) THEN
        WRITE (*,1001) PAR, 1, (PAR-1)/6, 1, PAR
1001    FORMAT ( ' PAR=', I3, '=',
     &           I3, '*(6*', I2, '+1)', '=', I3, '*', I3 )
        GOTO 20
      ENDIF
C
C SEARCH PRODUCT OF SMALL FACTORS F
C
      F = 1
      PACOPY = PAR
C
C CHECK FOR FACTORS 3 IN PAR
C
30    CONTINUE
      IF ( MOD(PACOPY,3) .EQ. 0 ) THEN
        F  = 3 * F
        PACOPY = PACOPY/3
        GOTO 30
      ENDIF
C
C CHECK FOR FACTORS 2 IN PAR
C
40    CONTINUE
      IF ( MOD(PACOPY,2) .EQ. 0 ) THEN
        F  = 2 * F
        PACOPY = PACOPY/2
        GOTO 40
      ENDIF
C
C AFTER DIVIDING OFF FACTORS 2 AND 3 CHECK
C AGAIN FOR FORM 6*K+1
C
      IF ( MOD(PACOPY-1,6) .EQ. 0 ) THEN
C IF THIS TEST IS NOT PASSED, PAR WILL NOT BE PRINTED
        WRITE (*,1001) PAR, F, (PACOPY-1)/6, F, PACOPY
      ENDIF
C END LOOPS OVER X AND Y
20    CONTINUE
10    CONTINUE
C END OF PROGRAM
      END
