Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Pythagorean quadruples drill
- function IsSquare(n::Int64)
- sn = round(Int64, sqrt(n))
- return sn^2 == n, sn
- end
- function CountQuadruples(N::Int64, verbose::Bool = false)
- z = 0
- for a = 1:N
- for b = a:N
- for c = b:N
- flag, d = IsSquare(a^2 + b^2 + c^2)
- if flag
- z += 1
- if verbose; println((a,b,c,d)); end
- end
- end
- end
- end
- return z
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement