Help in generating Ulam numbers

asked 2018-10-02 15:16:52 +0200

voodooguru gravatar image

updated 2018-10-02 15:42:59 +0200

I want to generate a list of Ulam numbers, with an Ulam number being defined by Wikipedia as "a member of an integer sequence that 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 but there's insufficient room here to post.

edit retag flag offensive close merge delete


This isn't a Sage related issue; it's a Python coding question. You can find working Python code for this problem on the internet with a simple internet search.

dazedANDconfused gravatar imagedazedANDconfused ( 2018-10-02 17:35:17 +0200 )edit

Could you please provide your code ? There is sufficient room.

tmonteil gravatar imagetmonteil ( 2018-10-02 21:11:42 +0200 )edit