giulio98/xlcost-single-prompt huggingface dataset:
# solve the linear equation of single variable | def to solve the given equation ; traverse the equation ; for cases such as : x , - x , + x ; flip sign once ' = ' is seen ; there may be a number left in the end ; for infinite solutions ; for no solution ; x = total sum / coeff of x ' - ' sign indicates moving numeric value to right hand side ; 
def solveEquation(equation):
    n = len(equation)
    sign = 1
    coeff = 0
    total = 0
    i = 0
    for j in range(0, n):
        if (equation[j] == '+' or equation[j] == '-'):
            if (j > i):
                total = (total + sign * int(equation[i:j]))
            i = j
        elif (equation[j] == 'x'):
            if ((i == j) or equation[j - 1] == '+'):
                coeff += sign
            elif (equation[j - 1] == '-'):
                coeff = coeff - sign
            else:
                coeff = (coeff + sign * int(equation[i:j]))
            i = j + 1
        elif (equation[j] == '='):
            if (j > i):
                total = (total + sign * int(equation[i:j]))
            sign = -1
            i = j + 1
    if (i < n):
        total = (total + sign * int(equation[i:len(equation)]))
    if (coeff == 0 and total == 0):
        return "Infinite solutions"
    if (coeff == 0 and total):
        return "No solution"
    ans = -total / coeff
    return int(ans)


equation = "x+5-3+x=6+x-2"
print("x = {}".format(solveEquation(equation)))

# Expected output:
x = 2
# check if a given number is pronic | efficient approach | python program to check if a number is pronic or not ; function to check pronic number ; checking pronic number by multiplying consecutive numbers ; 

import math


def pronic_check(n):
    x = (int)(math .sqrt(n))
    if (x * (x + 1) == n):
        return True
    else:
        return False


n = 56
if (pronic_check(n)):
    print("YES")
else:
    print("NO")

# Expected output:
YES
# check if given number is perfect square | python3 program for the above approach ; if ceil and floor are equal the number is a perfect square ; 

import math


def checkperfectsquare(x):
    if (math .ceil(math .sqrt(n)) == math .floor(math .sqrt(n))):
        print("perfect square")
    else:
        print("not a perfect square")


n = 49
checkperfectsquare(n)

# Expected output:
perfect square
# writing power function for large numbers | maximum number of digits in output ; this function multiplies x with the number represented by res [ ] . res_size is size of res [ ] or number of digits in the number represented by res [ ] . this function uses simple school mathematics for multiplication . this function may value of res_size and returns the new value of res_size ; initialize carry ; one by one multiply n with individual digits of res [ ] ; store last digit of ' prod ' in res [ ] ; put rest in carry ; put carry in res and increase result size ; this function finds power of a number x ; printing value "1" for power = 0 ; initialize result ; multiply x n times ( x ^ n = x * x * x ... . n times ) ; 

MAX = 100000


def multiply(x, res, res_size):
    carry = 0
    for i in range(res_size):
        prod = res[i] * x + carry
        res[i] = prod % 10
        carry = prod // 10
    while (carry):
        res[res_size] = carry % 10
        carry = carry // 10
        res_size += 1
    return res_size


def power(x, n):
    if (n == 0):
        print("1")
        return
    res = [0 for i in range(MAX)]
    res_size = 0
    temp = x
    while (temp != 0):
        res[res_size] = temp % 10
        res_size += 1
        temp = temp // 10
    for i in range(2, n + 1):
        res_size = multiply(x, res, res_size)
    print(x, "^", n, " = ", end="")
    for i in range(res_size - 1, -1, -1):
        print(res[i], end="")


exponent = 100
base = 2
power(base, exponent)

# Expected output:
2 ^ 100  = 1267650600228229401496703205376
# p | python 3 program to check if a number is a p - smooth number or not ; function to check if number n is a p - smooth number or not ; prime factorise it by 2 ; if the number is divisible by 2 ; check for all the possible numbers that can divide it ; prime factorize it by i ; stores the maximum if maximum and i , if i divides the number ; if n at the end is a prime number , then it a divisor itself ; 

import math


def check(n, p):
    maximum = -1
    while (not (n % 2)):
        maximum = max(maximum, 2)
        n = int(n / 2)
    for i in range(3, int(math .sqrt(n)), 2):
        while (n % i == 0):
            maximum = max(maximum, i)
            n = int(n / i)
    if (n > 2):
        maximum = max(maximum, n)
    return (maximum <= p)


n = 24
p = 7
if (check(n, p)):
    print("yes")
else:
    print("no")

# Expected output:
yes
# Program to Change RGB color model to HSV color model | Python3 program change RGB Color Model to HSV Color Model ; R , G , B values are divided by 255 to change the range from 0. .255 to 0. .1 : ; if cmax and cmax are equal then h = 0 ; if cmax equal r then compute h ; if cmax equal g then compute h ; if cmax equal b then compute h ; if cmax equal zero ; compute v ; print ( rgb_to_hsv ( 45 , 215 , 0 ) ) print ( rgb_to_hsv ( 31 , 52 , 29 ) )
def rgb_to_hsv(r, g, b):
    r, g, b = r / 255.0, g / 255.0, b / 255.0
    cmax = max(r, g, b)
    cmin = min(r, g, b)
    diff = cmax-cmin
    if cmax == cmin:
        h = 0
    elif cmax == r:
        h = (60 * ((g - b) / diff) + 360) % 360
    elif cmax == g:
        h = (60 * ((b - r) / diff) + 120) % 360
    elif cmax == b:
        h = (60 * ((r - g) / diff) + 240) % 360
    if cmax == 0:
        s = 0
    else:
        s = (diff / cmax) * 100
    v = cmax * 100
    return h, s, v


print(rgb_to_hsv(129, 88, 47))

# Expected output:
(30.0, 63.56589147286821, 50.588235294117645)
# time when minute hand and hour hand coincide | function to find the minute ; finding the angle between minute hand and the first hour hand ; 
def find_time(h1):
    theta = 30 * h1
    print("(", end="")
    print((theta * 2), "/ 11) minutes")


h1 = 3
find_time(h1)

# Expected output:
(180 / 11) minutes
# sum of series ( n ^ 2 | function that calculate the sum of the nth series ; using formula of the nth term ; 
def sum_series(n):
    nSquare = n * n
    return int(nSquare * (nSquare - 1) / 4)


n = 2
print(sum_series(n))

# Expected output:
3
# check if a number is sandwiched between primes | python program to check whether a number is sandwiched between two primes or not ; returns true if number n is prime ; 0 and 1 both are non - primes ; finding square root of n ; checking if n has any factor upto square root of n if yes its not prime ; 

import math


def isPrime(n):
    if (n == 0 or n == 1):
        return False
    root = int(math .sqrt(n))
    for i in range(2, root + 1):
        if (n % i == 0):
            return False
    return True


def isSandwitched(n):
    return (isPrime(n - 1) and isPrime(n + 1))


n = 642
print(n, end=" : ")
if (isSandwitched(n)):
    print("Yes")
else:
    print("No")
n = 9
print(n, end=" : ")
if (isSandwitched(n)):
    print("Yes")
else:
    print("No")

# Expected output:
642 : Yes
9 : No
# tomohiko sakamoto 's algorithm | function to implement tomohiko sakamoto algorithm ; array with leading number of days values ; if month is less than 3 reduce year by 1 ; 
def day_of_the_week(y, m, d):
    t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
    if (m < 3):
        y = y - 1
    return (y + y // 4 - y // 100 + y // 400 + t[m - 1] + d) % 7


day = 13
month = 7
year = 2017
print(day_of_the_week(year, month, day))

# Expected output:
4
# recursive program for prime number | returns true if n is prime , else return false . i is current divisor to check . ; base cases ; check for next divisor ; 
def isPrime(n, i=2):
    if (n <= 2):
        return True if (n == 2)else False
    if (n % i == 0):
        return False
    if (i * i > n):
        return true
    return isPrime(n, i + 1)


n = 15
if (isPrime(n)):
    print("Yes")
else:
    print("No")

# Expected output:
No
# square free number | python3 program to print all prime factors ; returns true if n is a square free number , else returns false . ; if 2 again divides n , then n is not a square free number . ; n must be odd at this point . so we can skip one element ( note i = i + 2 ) ; check if i is a prime factor ; if i again divides , then n is not square free ; 

from math import sqrt


def isSquareFree(n):
    if n % 2 == 0:
        n = n / 2
    if n % 2 == 0:
        return False
    for i in range(3, int(sqrt(n) + 1)):
        if n % i == 0:
            n = n / i
        if n % i == 0:
            return False
    return True


n = 10
if isSquareFree(n):
    print("Yes")
else:
    print("No")

# Expected output:
Yes
# area of a square from diagonal length | returns area of square from given diagonal ; 
def findArea(d):
    return (d * d) / 2


d = 10
print("%.2f" % findArea(d))

# Expected output:
50.00
# sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n | python program to find sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n - 1 ) ^ 2. ; function to find sum of series . ; 

import math


def sumOfSeries(n):
    sum = 0
    for i in range(1, n + 1):
        sum = sum + (2 * i - 1) * (2 * i - 1)
    return sum


n = 10
print(sumOfSeries(n))

# Expected output:
1330
# sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n | python program to find sum of series 1 ^ 2 + 3 ^ 2 + 5 ^ 2 + . . . + ( 2 * n - 1 ) ^ 2. ; function to find sum of series . ; formula to find sum of series . ; 

import math


def sumOfSeries(n):
    return int((n * (2 * n - 1) * (2 * n + 1)) / 3)


n = 10
print(sumOfSeries(n))

# Expected output:
1330
# program to implement standard error of mean | python 3 program to implement standard error of mean . ; function to find sample mean . ; loop to calculate sum of array elements . ; function to calculate sample standard deviation . ; function to calculate sample error . ; formula to find sample error . ; 

import math


def mean(arr, n):
    sm = 0
    for i in range(0, n):
        sm = sm + arr[i]
    return sm / n


def SSD(arr, n):
    sm = 0
    for i in range(0, n):
        sm = sm + (arr[i] - mean(arr, n)) * (arr[i] - mean(arr, n))
    return (math .sqrt(sm / (n - 1)))


def sampleError(arr, n):
    return SSD(arr, n) / (math .sqrt(n))


arr = [78.53, 79.62, 80.25, 81.05, 83.21, 83.46]
n = len(arr)
print(sampleError(arr, n))

# Expected output:
0.8063001922361159
# minimum moves to reach target on a infinite line | set 2 | python code to find minimum moves to reach target ; function to find minimum steps to reach target ; handling negatives by symmetry ; keep moving while sum is smaller i . e calculating n ; case 1 : d is even ; d is odd ; 

import math


def StepstoReachTarget(target):
    target = abs(target)
    n = math .ceil((-1.0 + math .sqrt(1 + 8.0 * target)) / 2)
    sum = n * (n + 1) / 2
    if (sum == target):
        return n
    d = sum - target
    if ((int(d) & 1) == 0):
        return n
    else:
        if (int(d) & 1):
            return n + 2
        return n + 1


target = 5
print(StepstoReachTarget(target))

# Expected output:
5
# sum of series 2 / 3 | function to find sum of series up - to n terms ; initializing counter by 1 ; variable to calculate result ; while loop until nth term is not reached ; boolean type variable for checking validation ; 
def seriesSum(n):
    i = 1
    res = 0.0
    sign = True
    while (n > 0):
        n = n - 1
        if (sign):
            sign = False
            res = res + (i + 1) / (i + 2)
            i = i + 2
        else:
            sign = True
            res = res - (i + 1) / (i + 2)
            i = i + 2
    return res


n = 5
print(round(seriesSum(n), 6))

# Expected output:
0.744012
# number of symmetric relations on a set | function find the square of n ; base case ; return 2 ^ ( n ( n + 1 ) / 2 ) ; 
def countSymmetric(n):
    if (n == 0):
        return 1
    return (1 << ((n * (n + 1)) // 2))


n = 3
print(countSymmetric(n))

# Expected output:
64
# program for centered nonagonal number | function to find nth centered nonagonal number ; formula to find nth centered nonagonal number . ; 
def centeredNonagonal(n):
    return (3 * n - 2) * (3 * n - 1) // 2


n = 10
print(centeredNonagonal(n))

# Expected output:
406
# program for mean absolute deviation | function to find mean of the array elements . ; calculate sum of all elements . ; function to find mean absolute deviation of given elements . ; calculate the sum of absolute deviation about mean . ; return mean absolute deviation about mean . ; 
def Mean(arr, n):
    sm = 0
    for i in range(0, n):
        sm = sm + arr[i]
    return sm // n


def meanAbsoluteDeviation(arr, n):
    absSum = 0
    for i in range(0, n):
        absSum = absSum + abs(arr[i] - Mean(arr, n))
    return absSum / n


arr = [10, 15, 15, 17, 18, 21]
n = len(arr)
print(meanAbsoluteDeviation(arr, n))

# Expected output:
2.6666666666666665
# find if it is possible to get a ratio from given ranges of costs and quantities | returns true if it is possible to get ratio r from given cost and quantity ranges . ; calculating cost corresponding to value of i ; 
def isRatioPossible(lowCost, upCost, lowQuant, upQuant, r):
    for i in range(lowQuant, upQuant + 1):
        ans = i * r
        if (lowCost <= ans and ans <= upCost):
            return True
    return False


lowCost = 14
upCost = 30
lowQuant = 5
upQuant = 12
r = 9
if (isRatioPossible(lowCost, upCost, lowQuant, upQuant, r)):
    print("Yes")
else:
    print("No")

# Expected output:
No
# find n integers with given difference between product and sum | function to implement calculation ; 
def pattern(n, d):
    for i in range(0, n - 2):
        print("1", end=" ")
    print("2", end=" ")
    print(n + d)


N = 3
D = 5
pattern(N, D)

# Expected output:
1 2 8
# sum of fourth powers of first n odd natural numbers | calculate the sum of fourth power of first n odd natural numbers ; 
def oddNumSum(n):
    return (n * (2 * n + 1) * (24 * n * n * n - 12 * n * n - 14 * n + 7)) / 15


n = 4
print(int(oddNumSum(n)))

# Expected output:
3108
# trailing number of 0 s in product of two factorials | returns number of zeros in factorial n ; dividing x by powers of 5 and update count ; returns count of trailing zeros in m ! x n ! ; 
def trailingZero(x):
    i = 5
    count = 0
    while (x > i):
        count = count + x // i
        i = i * 5
    return count


def countProductTrailing(M, N):
    return trailingZero(N) + trailingZero(M)


N = 67
M = 98
print(countProductTrailing(N, M))

# Expected output:
37
# trimorphic number | function to check trimorphic number ; store the cube ; start comparing digits ; return false , if any digit of n doesn ' t ▁ match ▁ with ▁ ▁ its ▁ cube ' s digits from last ; reduce n and cube ; 
def isTrimorphic(N):
    cube = N * N * N
    while (N > 0):
        if (N % 10 != cube % 10):
            return False
        N = N // 10
        cube = cube // 10
    return True


N = 24
if (isTrimorphic(N)):
    print("trimorphic")
else:
    print("not trimporphic")

# Expected output:
trimorphic
# trimorphic number | python3 program to find nth trimorphic number ; functions to find nth trimorphic number ; comparing the digits ; return false , if any digit of num doesn ' t ▁ match ▁ with ▁ ▁ its ▁ cube ' s digits from last ; reduce num and cube ; check in max int size ; check number is trimorphic or not ; if counter is equal to the n then return nth number ; 

import sys


def checkTrimorphic(num):
    cube = num * num * num
    while (num > 0):
        if (num % 10 != cube % 10):
            return False
        num = int(num / 10)
        cube = int(cube / 10)
    return True


def nthTrimorphic(n):
    count = 0
    for i in range(sys .maxsize):
        if (checkTrimorphic(i)):
            count += 1
        if (count == n):
            return i


if __name__ == '__main__':
    n = 9
    print(nthTrimorphic(n))

# Expected output:
49
# find minimum moves to reach target on an infinite line | python 3 program to find minimum moves to reach target if we can move i steps in i - th move . ; handling negatives by symmetry ; keep moving while sum is smaller or difference is odd . ; 
def reachTarget(target):
    target = abs(target)
    sum = 0
    step = 0
    while (sum < target or (sum - target) % 2 != 0):
        step = step + 1
        sum = sum + step
    return step


target = 5
print(reachTarget(target))

# Expected output:
5
# sum of fifth powers of the first n natural numbers | calculate the sum of fifth power of first n natural numbers ; 
def fifthPowerSum(n):
    return ((2 * n * n * n * n * n * n) + (6 * n * n * n * n * n) +
            (5 * n * n * n * n) - (n * n)) // 12


n = 5
print(fifthPowerSum(n))

# Expected output:
4425
# find unit digit of x raised to power y | returns unit digit of x raised to power y ; initialize result as 1 to handle case when y is 0. ; one by one multiply with x mod 10 to avoid overflow . ; 
def unitDigitXRaisedY(x, y):
    res = 1
    for i in range(y):
        res = (res * x) % 10
    return res


print(unitDigitXRaisedY(4, 2))

# Expected output:
6
# max occurring divisor in an interval | function to find max occurring divisor interval [ x , y ] ; if there is only one number in the in the interval , return that number ; otherwise , 2 is max occurring divisor ; 
def findDivisor(x, y):
    if (x == y):
        return y
    return 2


x = 3
y = 16
print(findDivisor(x, y))

# Expected output:
2
# average of squares of natural numbers | function to calculate average of square number ; 
def AvgofSquareN(n):
    sum = 0
    for i in range(1, n + 1):
        sum += (i * i)
    return sum / n


n = 2
print(AvgofSquareN(n))

# Expected output:
2.5
# find sum of even factors of a number | formula based python3 program to find sum of alldivisors of n . ; returns sum of all factors of n . ; if n is odd , then there are no even factors . ; traversing through all prime factors . ; while i divides n print i and divide n ; here we remove the 2 ^ 0 that is 1. all other factors ; this condition is to handle the case when n is a prime number . ; 

import math


def sumofFactors(n):
    if (n % 2 != 0):
        return 0
    res = 1
    for i in range(2, (int)(math .sqrt(n)) + 1):
        count = 0
        curr_sum = 1
        curr_term = 1
        while (n % i == 0):
            count = count + 1
            n = n // i
            if (i == 2 and count == 1):
                curr_sum = 0
            curr_term = curr_term * i
            curr_sum = curr_sum + curr_term
        res = res * curr_sum
    if (n >= 2):
        res = res * (1 + n)
    return res


n = 18
print(sumofFactors(n))

# Expected output:
26
# find lcm of rational numbers | python program to find lcm of given array ; get lcm of two numbers ; finds lcm of numerators ; calculate the lcm of all numerators ; return all numerator lcm ; get gcd of all the denominators ; calculate the gcd of all the denominators ; return all denominator gcd ; find lcm of all the rational number ; return the lcm of all numerator / gcd of all denominator ; 

import math


def LCM(a, b):
    return (a * b) // (math .gcd(a, b))


def lcmOfNumerator(vect):
    lcm = vect[0][0]
    for i in range(1, len(vect)):
        lcm = LCM(vect[i][0], lcm)
    return lcm


def gcdOfDemoninators(vect):
    gcd = vect[0][1]
    for i in range(1, len(vect)):
        gcd = math .gcd(vect[i][1], gcd)
    return gcd


def lcmOfRationals(vect):
    print(lcmOfNumerator(vect), "/", gcdOfDemoninators(vect), sep="")


vect = []
vect .append((2, 7))
vect .append((3, 14))
vect .append((5, 3))
lcmOfRationals(vect)

# Expected output:
30/1
# find sum of odd factors of a number | formula based python3 program to find sum of all divisors of n . ; returns sum of all factors of n . ; traversing through all prime factors . ; ignore even factors by of 2 ; while i divides n , print i and divide n ; this condition is to handle the case when n is a prime number . ; 

import math


def sumofoddFactors(n):
    res = 1
    while n % 2 == 0:
        n = n // 2
    for i in range(3, int(math .sqrt(n) + 1)):
        count = 0
        curr_sum = 1
        curr_term = 1
        while n % i == 0:
            count += 1
            n = n // i
            curr_term *= i
            curr_sum += curr_term
        res *= curr_sum
    if n >= 2:
        res *= (1 + n)
    return res


n = 30
print(sumofoddFactors(n))

# Expected output:
24
# number of non | return number of non negative integral solutions ; initialize total = 0 ; base case if n = 1 and val >= 0 then it should return 1 ; iterate the loop till equal the val ; total solution of equations and again call the recursive function solutions ( variable , value ) ; return the total no possible solution ; 
def countSolutions(n, val):
    total = 0
    if n == 1 and val >= 0:
        return 1
    for i in range(val + 1):
        total += countSolutions(n - 1, val - i)
    return total


n = 5
val = 20
print(countSolutions(n, val))

# Expected output:
10626
# fibonomial coefficient and fibonomial triangle | python3 program to print fibonomial triangle of height n . ; function to produce fibonacci series . ; 0 th and 1 st number of the series are 0 and 1 ; add the previous 2 numbers in the series and store it ; function to produce fibonomial coefficient ; function to print fibonomial triangle . ; finding the fibonacci series . ; to store triangle value . ; initialising the 0 th element of each row and diagonal element equal to 0. ; for each row . ; for each column . ; finding each element using recurrence relation . ; printing the fibonomial triangle . ; 

N = 6


def fib(f, n):
    f[0] = 0
    f[1] = 1
    for i in range(2, n + 1):
        f[i] = f[i - 1] + f[i - 2]


def fibcoef(fc, f, n):
    for i in range(n + 1):
        fc[i][0] = 1
    for i in range(1, n + 1):
        for j in range(1, i + 1):
            k = j
            while (k > 0):
                k -= 1
                fc[i][j] *= f[k]
            k = 1
            while ((j + 1) != k):
                fc[i][j] /= f[k]
                k += 1


def printFibonomialTriangle(n):
    f = [0] * (N + 1)
    fib(f, n)
    dp = [[0 for x in range(N + 1)]for y in range(N + 1)]
    for i in range(n + 1):
        dp[i][0] = 1
        dp[i][i] = 1
    for i in range(1, n + 1):
        for j in range(1, i):
            dp[i][j] = (f[i - j + 1] * dp[i - 1]
                        [j - 1] + f[j - 1] * dp[i - 1][j])
    for i in range(n + 1):
        for j in range(i + 1):
            print(dp[i][j], end=" ")
        print("")


n = 6
printFibonomialTriangle(n)

# Expected output:
1 
1 1 
1 1 1 
1 2 2 1 
1 3 6 3 1 
1 5 15 15 5 1 
1 8 40 60 40 8 1
# sum of arithmetic geometric sequence | python3 code to find the sum of first n terms . ; return the sum of first n term of agp ; finding the each term of agp and adding it to sum . ; 

import math


def sumofNterm(a, d, b, r, n):
    sum = 0
    for i in range(1, n + 1):
        sum += ((a + (i - 1) * d) * (b * math .pow(r, i - 1)))
    return int(sum)


a = 1
d = 1
b = 2
r = 2
n = 3
print(sumofNterm(a, d, b, r, n))

# Expected output:
34
# sum of the series 2 + ( 2 + 4 ) + ( 2 + 4 + 6 ) + ( 2 + 4 + 6 + 8 ) + …… + ( 2 + 4 + 6 + 8 + … . + 2 n ) | function to find the sum of the given series ; first term of each i - th term ; next term ; required sum ; 
def sumOfTheSeries(n):
    sum = 0
    for i in range(0, n + 1):
        k = 2
        for j in range(1, i + 1):
            sum = sum + k
            k = k + 2
    return sum


n = 5
ans = sumOfTheSeries(n)
print(ans)

# Expected output:
70
# program to find sum of series 1 * 2 * 3 + 2 * 3 * 4 + 3 * 4 * 5 + . . . + n * ( n + 1 ) * ( n + 2 ) | function to calculate sum of series . ; 
def sumOfSeries(n):
    sum = 0
    i = 1
    while i <= n:
        sum = sum + i * (i + 1) * (i + 2)
        i = i + 1
    return sum


n = 10
print(sumOfSeries(n))

# Expected output:
4290
# program to get the sum of series : 1 | python3 code to get the sum of the series ; function to get the series ; sum of n - 1 terms starting from 2 nd term ; 

import math


def Series(x, n):
    sum = 1
    term = 1
    y = 2
    for i in range(1, n):
        fct = 1
        for j in range(1, y + 1):
            fct = fct * j
        term = term * (-1)
        m = term * math .pow(x, y) / fct
        sum = sum + m
        y += 2
    return sum


x = 9
n = 10
print('%.4f' % Series(x, n))

# Expected output:
-5.1463