Monthly Archives: April 2011

Dumbbell Nebula – Messier 27


The Dumbbell Nebula (Messier 27 or NGC 6853) is a planetary nebula in the Vulpecula constellation, at a distance of about 1360 LY. Its central region contains the largest known white dwarf star.

For this image I used three 240 second exposures on Lightbuckets LB-0003 with the following filters:
Hydrogen-Alpha in Green
Sodium II in Red
Oxygen III in Blue

MaximDL was used to stack, align and screen stretch. The image was then cropped using Gimp.

Euler Problem 80


Python rocks. No surprise here. Its got a Decimal module that does everything. This routine runs inside of a second.

#Euler80
import decimal
from math import sqrt, floor
class Problem80:
    def __init__(self):
        pass
    def Solution(self):
        count = 0
        decimal.getcontext().prec = 110
        for n in range (1, 101):
            num = int(floor(sqrt(n)))
            text = str(decimal.Decimal(n).sqrt())[2:102]
            if len(text) == 100:
                count += num
                for i in range (0,99):
                    count += int(text[i])
            print n,count
        return "Answer = " + str(count)
if __name__ == '__main__':
    P = Problem80()
    print P.Solution()

Euler Problem 79

Just a simple substitution routine.

#Euler79
class Problem79:
    def __init__(self, list):
        self.list = list
    def Solution(self):
        code = [0,1,2,3,4,5,6,7,8,9]
        used = [0,1,2,3,4,5,6,7,8,9]
        for n in self.list:
            d0 = int(str(n)[0])
            if d0 in used:
                used.pop(used.index(d0))
            i0 = code.index(d0)
            d1 = int(str(n)[1])
            if d1 in used:
                used.pop(used.index(d1))
            i1 = code.index(d1)
            d2 = int(str(n)[2])
            if d2 in used:
                used.pop(used.index(d2))
            i2 = code.index(d2)
            print d0, d1, d2, i0, i1, i2, used, code,
            if i1 < i0:
                code.insert(i0+1, d1)
                code.pop(i1)
            if i2 < i1:
                code.insert(i1+1, d2)
                code.pop(i2)
            print code
        for n in used:
            code.pop(code.index(n))
        answer = ""
        for n in code:
            answer += str(n)
        return "Answer = " + answer
if __name__ == '__main__':
    P = Problem79([319,680,180,690,129,620,762,689,762,318,368,710,720,710,629,168,160,689,
        716,731,736,729,316,729,729,710,769,290,719,680,318,389,162,289,162,718,
        729,319,790,680,890,362,319,760,316,729,380,319,728,716])
    print P.Solution()