Aromatic plants P24799


Statement
 

pdf   zip

0.55 A friend of Professor Oak suggested him including some aromatic plants in his garden, and Prof. Oak thought that it was such a good idea. As you can see, now he has 11 such plants: 5 in the top row, and 6 in the bottom row. Hmm... so we have a prime number and a composite number that add up to a prime number. How common is that?

0.40

Input

Input consists of several cases, each with an integer nn between 2 and 10710^7.

Output

For every nn, print the number of triples of integer numbers (a,b,c)(a, b, c) such that:

  • the three numbers are between 2 and nn,

  • aa is prime, bb is composite, cc is prime,

  • and a+b=ca + b = c.

Public test cases
  • Input

    6
    7
    11
    1000
    10000000
    

    Output

    0
    1
    5
    13957
    220832173370
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++