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.

A048700 Binary palindromes of odd length (written in base 10).

This page as a plain text file.
%I A048700 #38 Feb 26 2021 16:41:48
%S A048700 1,5,7,17,21,27,31,65,73,85,93,99,107,119,127,257,273,297,313,325,341,
%T A048700 365,381,387,403,427,443,455,471,495,511,1025,1057,1105,1137,1161,
%U A048700 1193,1241,1273,1285,1317,1365,1397,1421,1453,1501,1533,1539,1571,1619,1651
%N A048700 Binary palindromes of odd length (written in base 10).
%C A048700 Note: you get A006995 (all binary palindromes) if you take (after zero) alternatively 2^n (starting from 2^0 = 1) terms from A048700 and as many from A048701 and then each time, twice as many from both.
%C A048700 A178225(a(n)) = 1. - _Reinhard Zumkeller_, Oct 21 2011
%C A048700 Comment from _Altug Alkan_, Dec 03 2015: (Start)
%C A048700 a(6*k) is divisible by 9 for k > 0.
%C A048700 a(3*k+(-1)^k-2) is divisible by 3 for k > 1.
%C A048700 The minimum value of a(n+1) - a(n) occurs when n = 2.
%C A048700 A014551(n) appears in this sequence for n > 0. (End)
%H A048700 Reinhard Zumkeller, <a href="/A048700/b048700.txt">Table of n, a(n) for n = 1..10000</a>
%F A048700 a(n) = (2^(floor_log_2(n)))*n + sum('(bit_i(n, i)*(2^(floor_log_2(n)-i)))', 'i'=1..floor_log_2(n));
%F A048700 a(A047264(n)) mod 3 = 0, for n > 1. - _Altug Alkan_, Dec 03 2015
%p A048700 bit_i := (x,i) -> `mod`(floor(x/(2^i)),2);
%p A048700 floor_log_2 := proc(n) local nn,i: nn := n; for i from -1 to n do if(0 = nn) then RETURN(i); fi: nn := floor(nn/2); od: end:
%t A048700 Select[Range@ 1651, # == Reverse@ # && OddQ@ Length@ # &@ IntegerDigits[#, 2] &] (* _Michael De Vlieger_, Dec 03 2015 *)
%o A048700 (PARI) {a(n) = local(f); if( n<1, 0, f = length(binary(n)) - 1; 2^f*n + sum(i=1, f, bittest(n,i) * 2^(f-i)))}; /* _Michael Somos_, Nov 27 2002 */
%o A048700 (Haskell)
%o A048700 import Data.Set (singleton, deleteFindMin, insert)
%o A048700 import Data.List (unfoldr)
%o A048700 a048700 n = a048700_list !! (n-1)
%o A048700 a048700_list = f 1 $ singleton 1 where
%o A048700    f z s = m : f (z+1) (insert (c 0) (insert (c 1) s')) where
%o A048700      c d = foldl (\v d -> 2 * v + d) 0 $ (reverse b) ++ [d] ++ b
%o A048700      b = unfoldr
%o A048700          (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2) z
%o A048700      (m,s') = deleteFindMin s
%o A048700 -- _Reinhard Zumkeller_, Oct 21 2011
%o A048700 (Python)
%o A048700 def A048700(n):
%o A048700     s = bin(n)[2:]
%o A048700     return int(s+s[-2::-1],2) # _Chai Wah Wu_, Feb 26 2021
%Y A048700 Cf. A048701 (binary palindromes of even length), A002113 (decimal palindromes), A006995 (all binary palindromes).
%Y A048700 Cf. also A178225.
%K A048700 nonn,base
%O A048700 1,2
%A A048700 _Antti Karttunen_, Mar 07 1999