This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A036241 #33 Sep 11 2023 17:50:57 %S A036241 1,2,3,5,8,14,25,45,82,140,235,388,559,839,1286,1582,2221,3144,4071, %T A036241 5795,6872,9204,11524,13796,17686,21489,26019,31080,37742,45067,53144, %U A036241 58365,67917,78484,91767,106513,118600,133486,147633,166034,174717 %N A036241 a(1)=1, a(2)=2, a(3)=3; for n >= 3, a(n) is smallest number such that all a(i) for 1 <= i <= n are distinct, all a(i)+a(j) for 1 <= i < j <= n are distinct and all a(i)+a(j)+a(k) for 1 <= i < j < k <= n are distinct. %D A036241 Letter from V. Jooste, Pretoria, South Africa, Sep. 8, 1975. %H A036241 Chai Wah Wu, <a href="/A036241/b036241.txt">Table of n, a(n) for n = 1..237</a> (n = 1..75 from Reinhard Zumkeller) %e A036241 For {1,2,3,4} we have 1+4 = 2+3, so a(4) is not 4. For {1,2,3,5} the terms 1, 2, 3, 5 are distinct, the sums 1+2, 1+3, 1+5, 2+3, 2+5, 3+5 are distinct and the sums 1+2+3, 1+2+5, 1+3+5, 2+3+5 are distinct, so a(4) = 5. %t A036241 a[1]=1; a[2]=2; a[3]=3; a[n_] := a[n] = Catch[For[an = a[n-1] + 1, True, an++, a[n] = an; t2 = Flatten[Table[a[i] + a[j], {i, 1, n}, {j, i+1, n}]]; If[n*(n-1)/2 == Length[Union[t2]], t3 = Flatten[Table[a[i] + a[j] + a[k], {i, 1, n}, {j, i+1, n}, {k, j+1, n}]]; If[ n*(n-1)*(n-2)/6 == Length[Union[t3]], Throw[an]]]]]; Table[Print[a[n]]; a[n], {n, 1, 41}] (* _Jean-François Alcover_, Jul 24 2012 *) %o A036241 (PARI) {unique(v)=local(b); b=1; for(j=2,length(v),if(v[j-1]==v[j],b=0)); b} %o A036241 {newsort(u,v,q)=local(s); s=[]; for(i=1,length(v),s=concat(s,v[i]+q)); vecsort(concat(u,s))} %o A036241 {m=175000; print1(1,",",2,",",3,","); w1=[1,2,3]; w2=[3,4,5]; w3=[6]; q=4; while(q<m,y1=concat(w1,q); y2=newsort(w2,w1,q); y3=newsort(w3,w2,q); if(unique(y1)&&unique(y2)&&unique(y3),w1=y1; w2=y2; w3=y3; print1(q,",")); q=q+1)} %o A036241 (Haskell) %o A036241 import qualified Data.Set as Set (null, map) %o A036241 import Data.Set (empty, fromList, toList, intersect, union) %o A036241 a036241 n = a036241_list !! (n-1) %o A036241 a036241_list = f [1..] [] empty empty where %o A036241 f (x:xs) ys s2 s3 %o A036241 | null (s2' `intersect` y2s) && null (s3' `intersect` y3s) %o A036241 = x : f xs (x:ys) (fromList s2' `union` s2) (fromList s3' `union` s3) %o A036241 | otherwise = f xs ys s2 s3 %o A036241 where s2' = sort $ map (x +) ys %o A036241 s3' = sort $ map (x +) y2s %o A036241 y2s = toList s2 %o A036241 y3s = toList s3 %o A036241 -- _Reinhard Zumkeller_, Oct 02 2011 %o A036241 (Python) %o A036241 from itertools import count, islice %o A036241 def A036241_gen(): # generator of terms %o A036241 aset2, aset3 = {3,4,5}, {6} %o A036241 yield from (alist:=[1,2,3]) %o A036241 for k in count(4): %o A036241 bset2, bset3 = set(), set() %o A036241 for a in alist: %o A036241 if (b2:=a+k) in aset2: %o A036241 break %o A036241 bset2.add(b2) %o A036241 else: %o A036241 for a2 in aset2: %o A036241 if (b3:=a2+k) in aset3: %o A036241 break %o A036241 bset3.add(b3) %o A036241 else: %o A036241 yield k %o A036241 alist.append(k) %o A036241 aset2.update(bset2) %o A036241 aset3.update(bset3) %o A036241 A036241_list = list(islice(A036241_gen(),20)) # _Chai Wah Wu_, Sep 10 2023 %Y A036241 Cf. A011185, A062065, A051912, A060276. %K A036241 nonn,nice %O A036241 1,2 %A A036241 _N. J. A. Sloane_ %E A036241 Better description and more terms from _Naohiro Nomoto_, Jul 02 2001 %E A036241 Edited by and terms a(30) to a(41) from _Klaus Brockhaus_, May 21 2003