• 沒有找到結果。

Given the value of N , you will have to find the value of G. The definition of G is given below:

N/A
N/A
Protected

Academic year: 2021

Share "Given the value of N , you will have to find the value of G. The definition of G is given below:"

Copied!
1
0
0

加載中.... (立即查看全文)

全文

(1)

11417 GCD

Given the value of N , you will have to find the value of G. The definition of G is given below:

G =

i<N

i=1 j

≤N j=i+1

GCD(i, j)

Here GCD(i, j) means the greatest common divisor of integer i and integer j.

For those who have trouble understanding summation notation, the meaning of G is given in the following code:

G=0;

for(i=1;i<N;i++) for(j=i+1;j<=N;j++) {

G+=GCD(i,j);

}

/*Here GCD() is a function that finds the greatest common divisor of the two input numbers*/

Input

The input file contains at most 100 lines of inputs. Each line contains an integer N (1 < N < 501).

The meaning of N is given in the problem statement. Input is terminated by a line containing a single zero. This zero should not be processed.

Output

For each line of input produce one line of output. This line contains the value of G for corresponding N .

Sample Input 10

100 500 0

Sample Output 67

13015

442011

參考文獻

相關文件

• The XYZ.com bonds are equivalent to a default-free zero-coupon bond with $X par value plus n written European puts on Merck at a strike price of $30.. – By the

– Zero flag – destination equals zero – Sign flag – destination is negative – Carry flag – unsigned value out of range – Overflow flag – signed value out of range. • The

• The XYZ.com bonds are equivalent to a default-free zero-coupon bond with $X par value plus n written European puts on Merck at a strike price of $30. – By the

• The XYZ.com bonds are equivalent to a default-free zero-coupon bond with $X par value plus n written European puts on Merck at a strike price of $30. – By the

• The XYZ.com bonds are equivalent to a default-free zero-coupon bond with $X par value plus n written European puts on Merck at a strike price of $30.. – By the

EQUIPAMENTO SOCIAL A CARGO DO INSTITUTO DE ACÇÃO SOCIAL, Nº DE UTENTES E PESSOAL SOCIAL SERVICE FACILITIES OF SOCIAL WELFARE BUREAU, NUMBER OF USERS AND STAFF. ᑇؾ N

You are given the desired boiling point of an ethylene glycol solution containing 1.0 kg of water and asked to find the mass of ethylene glycol you need to add to achieve the

You are given the wavelength and total energy of a light pulse and asked to find the number of photons it