cp's OEIS Frontend

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.

A004758 Binary expansion starts 110.

This page as a plain text file.
%I A004758 #27 Jul 14 2022 02:36:55
%S A004758 6,12,13,24,25,26,27,48,49,50,51,52,53,54,55,96,97,98,99,100,101,102,
%T A004758 103,104,105,106,107,108,109,110,111,192,193,194,195,196,197,198,199,
%U A004758 200,201,202,203,204,205,206,207,208,209,210,211,212,213
%N A004758 Binary expansion starts 110.
%H A004758 Reinhard Zumkeller, <a href="/A004758/b004758.txt">Table of n, a(n) for n = 1..4095</a>
%F A004758 a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 5*[n==0].
%F A004758 a(n) = n + 5 * 2^floor(log_2(n)) = A004757(n) + A053644(n).
%F A004758 a(2^m+k) = 6*2^m + k, m >= 0, 0 <= k < 2^m. - _Yosu Yurramendi_, Aug 08 2016
%e A004758 26 in binary is 11010, so 26 is in sequence.
%t A004758 w = {1, 1, 0}; Select[Range[5, 213], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* or *)
%t A004758 Table[n + 5*2^Floor@ Log2@ n, {n, 53}] (* _Michael De Vlieger_, Aug 10 2016 *)
%o A004758 (PARI) a(n)=n+5*2^floor(log(n)/log(2))
%o A004758 (Haskell)
%o A004758 import Data.List (transpose)
%o A004758 a004758 n = a004758_list !! (n-1)
%o A004758 a004758_list = 6 : concat (transpose [zs, map (+ 1) zs])
%o A004758                    where zs = map (* 2) a004758_list
%o A004758 -- _Reinhard Zumkeller_, Dec 03 2015
%o A004758 (Python)
%o A004758 def A004758(n): return n+(5<<n.bit_length()-1) # _Chai Wah Wu_, Jul 13 2022
%Y A004758 Cf. A004754 (10), A004755 (11), A004756 (100), A004757 (101), A004759 (111).
%Y A004758 Cf. A004760, A053644, A062050, A076877.
%K A004758 nonn,base,easy
%O A004758 1,1
%A A004758 _N. J. A. Sloane_
%E A004758 Edited by _Ralf Stephan_, Oct 12 2003