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 A121173 #28 Oct 14 2024 17:59:54 %S A121173 2,2,4,8,6,22,8,52,10,114,12,240,14,494,16,1004,18,2026,20,4072,22, %T A121173 8166,24,16356,26,32738,28,65504,30,131038,32,262108,34,524250,36, %U A121173 1048536,38,2097110,40,4194260,42,8388562,44,16777168,46,33554382 %N A121173 Sequence S with property that for n in S, a(n) = a(1) + a(2) +...+ a(n-1) and for n not in S, a(n) = n+1. %C A121173 a(1)=1 cannot happen, so the sequence S starts with a(1)=2. %C A121173 Note that a(n)=a(1)+a(2)+...+a(n-1) can hold even if n is not in S. The smallest example is n=3. %C A121173 All terms are even. - _Reinhard Zumkeller_, Nov 06 2013 %H A121173 Reinhard Zumkeller, <a href="/A121173/b121173.txt">Table of n, a(n) for n = 1..1000</a> %F A121173 a(2*n) = A145654(n+1). - _Reinhard Zumkeller_, Nov 06 2013 %F A121173 a(2*n+1) = 2*n+2. %F A121173 From _Colin Barker_, Jan 30 2016: (Start) %F A121173 a(n) = 2*(2^(n/2+1)-2)-n for n even. %F A121173 a(n) = n+1 for n odd. %F A121173 a(n) = -a(n-1)+3*a(n-2)+3*a(n-3)-2*a(n-4)-2*a(n-5) for n>5. %F A121173 G.f.: 2*x*(1+2*x) / ((1-x)*(1+x)^2*(1-2*x^2)). (End) %F A121173 E.g.f.: (x - 4)*cosh(x) + 4*cosh(sqrt(2)*x) + (1 - x)*sinh(x). - _Stefano Spezia_, Oct 14 2024 %t A121173 s={2};Do[If[MemberQ[s,n],m=Total[s],m=n+1];AppendTo[s,m],{n,2,46}];s (* _James C. McMahon_, Oct 13 2024 *) %o A121173 (Haskell) %o A121173 a121173 n = a121173_list !! (n-1) %o A121173 a121173_list = f 1 [] where %o A121173 f x ys = y : f (x + 1) (y : ys) where %o A121173 y = if x `elem` ys then sum ys else x + 1 %o A121173 -- _Reinhard Zumkeller_, Nov 06 2013 %o A121173 (Python) %o A121173 from itertools import count, islice %o A121173 def agen(): # generator of terms %o A121173 S, s, an = {2}, 2, 2 %o A121173 for n in count(2): %o A121173 yield an %o A121173 an = s if n in S else n+1 %o A121173 s += an %o A121173 S.add(an) %o A121173 print(list(islice(agen(), 50))) # _Michael S. Branicky_, Oct 13 2024 %Y A121173 Cf. A105753, A121053, A121174, A121175, A145654. %K A121173 nonn %O A121173 1,1 %A A121173 _Max Alekseyev_, Aug 15 2006