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 A076827 #15 May 07 2022 09:26:39 %S A076827 1,2,1,2,3,2,3,4,5,6,5,6,5,6,7,6,7,8,7,8,9,8,9,8,9,10,11,10,11,12,13, %T A076827 14,13,14,15,16,15,16,17,18,17,18,17,18,19,20,21,20,21,20,21,22,23,24, %U A076827 23,24,23,24,25,26,27,26,27,26,27,28,27,28,29,28,29,30,29,30,29,30,31 %N A076827 Number of odd terms minus number of even terms in the set S(n) = ( A002977(k) : k<=n). %H A076827 Amiram Eldar, <a href="/A076827/b076827.txt">Table of n, a(n) for n = 1..10000</a> %H A076827 Amiram Eldar, <a href="/A076827/a076827.jpg">Plot of a(n)/n for n = 1000..10000</a> %F A076827 a(n) = (-1)*Sum_{k=1..n} (-1)^A002977(k). %F A076827 a(n) > 0 and a(n) seems to be asymptotic to c*n where c = 0.4... %e A076827 S(12) = (1,3,4,7,9,10,13,15,19,21,22,27) and there are 9 odd terms and 3 even terms in S(12), hence a(12) = 9-3 = 6. %t A076827 seq[max_] := Module[{s = Flatten[NestWhileList[Flatten[{2*# + 1, 3*# + 1}] &, 1, Min[#1] < max &]], t}, t = Union[Select[s, # <= max &]]; FoldList[Plus, -(-1)^t]]; seq[300] (* _Amiram Eldar_, May 07 2022 *) %Y A076827 Cf. A002977. %K A076827 nonn %O A076827 1,2 %A A076827 _Benoit Cloitre_, Nov 20 2002