Diferență între revizuiri ale paginii „DSA Homework 1”

De la WikiLabs
Jump to navigationJump to search
 
(Nu s-a afișat o versiune intermediară efectuată de același utilizator)
Linia 22: Linia 22:
  
 
== Restrictions ==
 
== Restrictions ==
1 ≤ N ≤ 1.000.000
+
1 ≤ N ≤ 100
  
 
== Examples ==
 
== Examples ==
  
 
{| class="wikitable"
 
{| class="wikitable"
|- bgcolor="#ddffdd" align="center"
+
|- bgcolor="#ddeeff" align="center"
 
|'''Input''' || '''Output'''
 
|'''Input''' || '''Output'''
 
|- bgcolor="#ddffdd" align="center"
 
|- bgcolor="#ddffdd" align="center"

Versiunea curentă din 28 februarie 2014 13:34

Fractions

Little John is doing math homework and he started writing on a piece of paper a sequence of irreducible fractions of type P/Q, where 1 ≤ P,Q ≤ N, where N is a natural number chosen by him. For example, for number N = 4, he got the following sequence:


1/1 1/2 1/3 1/4 2/1 2/3 3/1 3/2 3/4 4/1 4/3


Little John then counted the elements and he saw that for N = 4, there are 11 fractions.

Requirement

Given a natural number N, determine the number of fractions in the sequence constructed with the rules above.

Input Data

Natural number N is read from the keyboard.

Output Data

The program should output one number, representing the number of fractions in the sequence for the given number N.

Restrictions

1 ≤ N ≤ 100

Examples

Input Output
3 7
4 11
5 19
10 63