Next one in the series P40593


Statement
 

pdf   zip

thehtml

Consider the series

0, ‍ 0 + 1, ‍ 0 + 1 + 2, ‍ 0 + 1 + 2 + 3, ‍ 0 + 1 + 2 + 3 + 4, ‍ …   =   0, ‍ 1, ‍ 3, ‍ 6, ‍ 10, ‍ …

Write a program that, for every given natural number n, prints the first number of the series greater than or equal to n.

Input

Input consists of a sequence of natural numbers n.

Output

For every n, print the first number of the series 0, 1, 3, 6, … that is greater than or equal to n.

Public test cases
  • Input

    6
    7
    1
    2
    

    Output

    6
    10
    1
    3
    
  • 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