#!/usr/bin/python3

import numpy as np
import matplotlib.pyplot as plt
import math as math

#Q3a
def sumfunc(n): #returns the sum of the first n nonnegative integers
    ans = 0
    for i in range(0,n+1): #add all elements of range(0,n+1)
        ans = ans + i
    return ans

print(sumfunc(100))



#Q3b
def sumfunc(n): #returns the sum of the odd squares up to n^2
    ans = 0
    for i in range(0,n+1): #add all elements of range(0,n+1)
        if i%2 == 1: #check that integer is odd
            ans = ans + i**2
    return ans

print(sumfunc(50))


#Q3c
def sumfunc(n): #returns the sum of the odd squares up to n^2
    ans = 0
    for i in range(0,n+1): #add all elements of range(0,n+1)
        sq = i**2
        if sq%3 != 0: #check that square is not divisible by 3
            ans = ans + sq
    return ans

print(sumfunc(50))



#Q3d
def sumfunc(n): #returns the smallest sum of integers larger than n
    ans = 0
    i = 1 #integer to add
    while ans < n: #execute while the sum is not 10000
        ans = ans + i
        i=i+1 #increment integer
    return i

print(sumfunc(10000))






