! Brute force search for solutions to 711 puzzle ! x+y+z+r = 711, ! x*y*z*(711-x-y-z) = 711 * 10**6 ! All prices are in cents. ! All combinations such that x <= y <= z are generated ! but only if x <= y <= z <= r the equation is checked. integer :: n, x,y,z,r n = 0 do x = 1,708 do y = x,709-x do z = y,710-x-y r = 711-x-y-z if (r < z) cycle n = n+1 if (x*y*z*r==711000000) print*,'x,y,z,r',x,y,z,r,' cents' end do end do end do print*, ' checked',n,' cases' end