%I #38 Oct 16 2023 01:42:20
%S 1,2,2,3,3,4,4,5,5,6,6,6,6,6,6,7,7,8,8,8,8,9,9,9,9,9,9,10,10,10,10,11,
%T 11,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,14,14,14,14,
%U 14,14,14,14,14,14,14,14,15,15,16,16,16,16,16,16,16
%N The index (in A006995) of the greatest binary palindrome <= n; also the 'lower inverse' of A006995.
%C The greatest m such that A006995(m)<= n;
%C The number of binary palindromes <= n;
%C n is palindromic iff a(n)=A206916(n);
%C a(n) is the number of the binary palindrome A206913(n);
%C if n is a binary palindrome, then A006995(a(n))=n, so a(n) is 'inverse' with respect to A006995.
%C Partial sums of the binary palindromic characteristic function A178225.
%H Paolo Xausa, <a href="/A206915/b206915.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = max(m | A006995(m) <= n);
%F a(A006995(n)) = n;
%F A006995(a(n)) <= n, equality holds true iff n is a binary palindrome;
%F Let p = A206913(n), m = floor(log_2(p)) and p>2, then:
%F a(n) = (((5-(-1)^m)/2) + sum_{k=1..floor(m/2)} (floor(p/2^k) mod 2)/2^k)) * 2^floor(m/2).
%F a(n) = (1/2)*((6-(-1)^m)*2^floor(m/2) - 1 - sum_{k=1..floor(m/2)} (-1)^floor(p/2^k) * 2^(floor(m/2)-k))).
%F a(n) = (5-(-1)^m) * 2^floor(m/2)/2 - 3*sum_{k=2..floor(m/2)} (floor(p/2^k) * 2^floor(m/2)/2^k) + (floor(p/2) * 2^floor(m/2)/2 - 2*floor((p/2) * 2^floor(m/2)) * floor((m-1)/m+1/2).
%F Partial sums S(n) = sum_{k=0..n} a(k):
%F S(n) = (n+1)*a(n) - A206920(a(n)).
%F G.f.: g(x) = (1+x+x^3+sum_{j>=1} x^(3*2^j)*(f_j(x)+f_j(1/x)))/(1-x), where the f_j(x) are defined as follows:
%F f_1(x) = x, and for j>1,
%F f_j(x) = x^3*product_{k=1..floor((j-1)/2)} (1+x^b(j,k)), where b(j,k)=2^(floor((j-1)/2)-k)*((3+(-1)^j)*2^(2*k+1)+4) for k>1, and b(j,1)=(2+(-1)^j)*2^(floor((j-1)/2)+1).
%e a(1)=2 since 2 is the index number of the greatest binary palindrome <= 1;
%e a(5)=4 since there are only 4 binary palindromes (namely 0,1,3 and 5) which are less than or equal to 5;
%e a(10)=6 since A006995(6)=9<=10, but A006995(7)=15>10, and so that, 6 is the index number of greatest binary palindrome <= 10;
%t A178225[n_]:=Boole[PalindromeQ[IntegerDigits[n,2]]];
%t Accumulate[Array[A178225,100,0]] (* _Paolo Xausa_, Oct 15 2023 *)
%Y Cf. A006995, A206914, A206916, A206920.
%K nonn,base
%O 0,2
%A _Hieronymus Fischer_, Feb 15 2012
|