Quick actions

cmd+k|ctrl+k

Navigation

Languages

aoc2017-day03-2

Snippet info

Language

Python

Visibility

public

Author

christophe.guillon.perso

Created

2017-12-05T18:11:44Z

Updated

2017-12-06T09:13:53Z

import sys
import math

def doit(input):
    i = 0
    p = 0
    spiral = []
    while i < 3:
        s = (2*i+1)**2
        d = 8*(i+1)
        spiral.append([[s+d], (s+d)*(s+d-1)/2])
        print(i, s+d, (s+d)*(s+d-1)/2)
        i += 1
    return "%s" % spiral

input = sys.stdin.read()
print(doit(input))
INFO