Files
contests/projecteuler/012/main.py

39 lines
650 B
Python

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()