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 A086799 #60 Feb 16 2025 08:32:50 %S A086799 1,3,3,7,5,7,7,15,9,11,11,15,13,15,15,31,17,19,19,23,21,23,23,31,25, %T A086799 27,27,31,29,31,31,63,33,35,35,39,37,39,39,47,41,43,43,47,45,47,47,63, %U A086799 49,51,51,55,53,55,55,63,57,59,59,63,61,63,63,127,65,67,67,71,69,71 %N A086799 Replace all trailing 0's with 1's in binary representation of n. %C A086799 a(k+1) = smallest number greater than k having in its binary representation exactly one 1 more than k has; A000120(a(n)) = A063787(n). - _Reinhard Zumkeller_, Jul 31 2010 %C A086799 a(n) is the least m >= n-1 such that the Hamming distance D(n-1,m) = 1. - _Vladimir Shevelev_, Apr 18 2012 %C A086799 The number of appearances of k equals the 2-adic valuation of k+1. - _Ali Sada_, Dec 20 2024 %H A086799 Reinhard Zumkeller, <a href="/A086799/b086799.txt">Table of n, a(n) for n = 1..10000</a> %H A086799 Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a> %H A086799 Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a> %H A086799 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/BinaryCarrySequence.html">Binary Carry Sequence</a> %H A086799 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/OddPart.html">Odd Part</a> %H A086799 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A086799 a(n) = n + 2^A007814(n) - 1. %F A086799 a(n) is odd; a(n) = n iff n is odd. %F A086799 a(a(n)) = a(n); A007814(a(n)) = a(n); A000265(a(n)) = a(n). %F A086799 A023416(a(n)) = A023416(n) - A007814(n) = A086784(n). %F A086799 A000120(a(n)) = A000120(n) + A007814(n). %F A086799 a(2^n) = a(A000079(n)) = 2*2^n - 1 = A000051(n+1). %F A086799 a(n) = if n is odd then n else a(n/2)*2 + 1. %F A086799 a(n) = A006519(n) + n - 1. - _Reinhard Zumkeller_, Feb 02 2007 %F A086799 a(n) = n OR n-1 (bitwise OR of consecutive numbers). - _Russ Cox_, May 15 2007 %F A086799 a(2*n) = A038712(n) + 2*n. - _Reinhard Zumkeller_, Aug 07 2011 %F A086799 a((2*n-1)*2^p) = 2^(p+1)*n-1, p >= 0. - _Johannes W. Meijer_, Feb 01 2013 %F A086799 Sum_{k=1..n} a(k) ~ n^2/2 + (1/(2*log(2)))*n*log(n) + (3/4 + (gamma-1)/(2*log(2)))*n, where gamma is Euler's constant (A001620). - _Amiram Eldar_, Nov 24 2022 %e A086799 a(20) = a('10100') = '10100' + '11' = '10111' = 23. %p A086799 nmax:=70: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := 2^(p+1)*n-1 od: od: seq(a(n), n=1..nmax); # _Johannes W. Meijer_, Feb 01 2013 %t A086799 Table[BitOr[(n + 1), n], {n, 0, 100}] (* _Vladimir Joseph Stephan Orlovsky_, Jul 19 2011 *) %o A086799 (C) int a(int n) { return n | (n-1); } // _Russ Cox_, May 15 2007 %o A086799 (Haskell) %o A086799 a086799 n | even n = (a086799 $ div n 2) * 2 + 1 %o A086799 | otherwise = n %o A086799 -- _Reinhard Zumkeller_, Aug 07 2011 %o A086799 (PARI) a(n)=bitor(n,n-1) \\ _Charles R Greathouse IV_, Apr 17 2012 %o A086799 (Python) %o A086799 def a(n): return n | (n-1) %o A086799 print([a(n) for n in range(1, 71)]) # _Michael S. Branicky_, Jul 13 2022 %Y A086799 Cf. A000051, A000079, A000120, A000265, A001620, A006519, A007814, A023416, A038712, A063787, A086784. %Y A086799 Cf. also A007088, A179857, A220466. %K A086799 nonn,base %O A086799 1,2 %A A086799 _Reinhard Zumkeller_, Aug 05 2003