Fermat's last theorem (3) P94857


Statement
 

pdf   zip

thehtml

This is another exercise about Fermat’s last theorem, which was explained in the exercise ‍



Write a program that, given four natural numbers a,b,c,d with ab and cd, prints the number of solutions to the equation

  x2 + y2 = z2

such that axb and cyd.

Input

Input has several cases. Each case consists of four natural numbers a, b, c, d such that ab and cd.

Output

For every case, print in a line the number of solutions to the equation

  x2 + y2 = z2

that fulfill axb and cyd.

Public test cases
  • Input

    2 5 4 13
    1 1 2 3
    

    Output

    2
    0
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Python