#3658

GCD of Odd and Even Sums

easy · 84.8% accepted · 96 likes · top 96%

math · number theory

Description

You are given an integer n. Your task is to compute the GCD (greatest common divisor) of two values:

-

sumOdd: the sum of the smallest n positive odd numbers.



-

sumEven: the sum of the smallest n positive even numbers.



Return the GCD of sumOdd and sumEven.

Solution