Next prime number P50095


Statement
 

pdf   zip

thehtml

Write a program that reads a sequence of prime numbers and, for each one, prints the next prime number.

Input

Input is all natural numbers, and consists of a sequence of prime numbers ended with a non-prime number.

Output

For every given prime number, print in a line the next prime number.

Public test cases
  • Input

    7
    2
    107
    12
    

    Output

    11
    3
    109
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python Rust