Work in progress, 15 doesn't work like intended
This commit is contained in:
39
12/main.py
Normal file
39
12/main.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import os
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
|
||||
# Triangle numbers are simply the sum of all natural numbers.
|
||||
# Then, find the first triangle number that has over five hundred divisors.
|
||||
|
||||
|
||||
def getTriangle(n):
|
||||
# return sum(range(1, n + 1))
|
||||
# Instead just use the formula like any normal human being
|
||||
|
||||
return int(n * (n+1) / 2)
|
||||
|
||||
def getTriangles(n):
|
||||
return [getTriangle(x) for x in range(1, n + 1)]
|
||||
|
||||
|
||||
def getNumberOfDivs(n):
|
||||
# Fuck this function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
print("Hello, this is Patrick")
|
||||
|
||||
ts = getTriangles(7)
|
||||
print(ts)
|
||||
|
||||
for t in ts:
|
||||
print(getNumberOfDivs(t))
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user