Beispiel #1
0
def p45():
    n = 100000

    t = triangular_n(1, n)
    p = pentagonal_n(1, n)
    h = hexagonal_n(1, n)

    return set.intersection(t, p, h)
Beispiel #2
0
def p42():
    tnumbers = triangular_n(1, 20, 'set')
    words = readFromFile("p42.txt")

    count = 0
    for word in words:
        val = alphabetical_value(word, 'uppercase')
        if val in tnumbers : count += 1

    return count