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 A339597 #34 Jan 12 2024 22:26:15 %S A339597 1,2,5,4,9,10,13,8,17,18,21,20,25,26,29,16,33,34,37,36,41,42,45,40,49, %T A339597 50,53,52,57,58,61,32,65,66,69,68,73,74,77,72,81,82,85,84,89,90,93,80, %U A339597 97,98,101,100,105,106,109,104,113,114,117,116,121,122,125,64,129,130,133,132,137 %N A339597 When 2*n+1 first appears in A086799. %H A339597 Michel Marcus, <a href="/A339597/b339597.txt">Table of n, a(n) for n = 0..10000</a> %H A339597 Christian Krause, <a href="https://github.com/ckrause/loda/blob/master/programs/oeis/339/A339597.asm">LODA program</a> %F A339597 a(n) = 2*(n+1) - A006519(n+1) = n+1 with a 0 bit inserted above its least significant 1-bit. - _Kevin Ryde_, Mar 29 2021 %F A339597 a(n) = A129760(n+1) + n+1. - _Christian Krause_, May 05 2021 %p A339597 N := 127: # for a(0) to a(N) %p A339597 V := Array(0..N): count := 0: %p A339597 for i from 1 while count < N+1 do %p A339597 with(MmaTranslator[Mma]): %p A339597 f(i) := BitOr(i,i-1); %p A339597 v := (f(i)-1)/2; %p A339597 if v <= N and V[v] = 0 then count := count+1; V[v] := i fi %p A339597 od: %p A339597 convert(V,list); # _Robert Israel_, Jan 07 2021 %o A339597 (PARI) f(n) = bitor(n, n-1); \\ A086799 %o A339597 a(n) = my(k=1); while (f(k) != 2*n+1, k++); k; \\ _Michel Marcus_, Jan 07 2021 %o A339597 (PARI) a(n) = n++; n<<1 - 1<<valuation(n,2); \\ _Kevin Ryde_, Mar 29 2021 %o A339597 (Python) %o A339597 def A339597(n): return ((m:=n+1)<<1)-(m&-m) # _Chai Wah Wu_, Sep 01 2023 %Y A339597 Cf. A086799, A091072 (terms sorted), A129760. %K A339597 nonn,easy %O A339597 0,2 %A A339597 _Marc LeBrun_ and _N. J. A. Sloane_, Jan 06 2021