### Help in generating Ulam numbers

I want to generate a list of Ulam numbers (defined by Wikipedia as "a member of an integer sequence devised by and named after Stanislaw Ulam, who introduced it in 1964. The standard Ulam sequence ... starts with U_1 = 1 and U_2 = 2. Then for n > 2, U_n is defined to be the smallest integer that is the sum of two distinct earlier terms in exactly one way and larger than all earlier terms." The code I've written doesn't work. I don't know why I get an "IndexError: list index out of range" (at line ~~8).~~8). Unfortunately, the indenting and line breaks don't seem to show up in the preview.

ulam=[1,2,3,4]
k=4
while k<10:
count=0
for x in range(0,k):
for y in range(0,k):
if ulam[x]<ulam[y]: if="" ulam[x]+ulam[y]="=ulam[k-1]+1:" count+="1" if="" count="=1:" ulam.append(ulam[k-1]+1)="" k+="1" print="" ulam<="" p="">