

A178225


Characteristic function of A006995 (binary palindromes).


19



1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


COMMENTS

a(n)=1 if n is in A006995, a(n)=0 otherwise.
For small n, identical to parity of A175096.
Comment by Franklin T. AdamsWatters: (Start)
Any permutation of the runs of n gives another such permutation when reversed. This pairs up all nonpalindromic permutations of the runs of n. Thus the parity of A175096(n) is the parity of the number of palindromic runpermutations of n. For small n, this is 1 when n is a binary palindrome, and 0 otherwise.
The first exception is 43, binary 101011, which has a nontrivial palindromic runpermutation 45, binary 101101. Another kind of exception occurs first for n = 365, binary 101101101, which is a palindrome, but has another palindromic runpermutation 427, binary 110101011. (End)
Given an index n such that a(n)=1, then the following A164126(A206915(n))1 terms will be 0. n'=A164126(A206915(n)) is the next term with a(n')=1. Therefore, if we subtract 1 from each term of A164126, we get the sequence of run lengths of 0's.  Hieronymus Fischer, Feb 19 2012.
Given an index n such that a(n)=0, then p=A206913(n) is the greatest index p<n such that a(p)=1, hence, a(k)=0 for all k with p<k<=n. Similarly, q=A206914(n) is the least index q>n such that a(q)=1, which implies a(k)=0 for all k with n<=k<q.  Hieronymus Fischer, Feb 19 2012.
Binary palindromes are distributed symmetrically with respect to threefold multiples of powers of 2. This becomes obvious by the generating function g(x) below. Example for the resulting factors of x^(3*2^5)=x^96: the factors are x^q and x^(q) for q=3,11,23,31. Thus, the palindromes are 96+3, 963, 96+11, 9611, 96+23, 9623, 96+31, 9631. The respective number of palindromes with this property is 2^(floor(m/2)), where m is the exponent of the corresponding power of 2.  Hieronymus Fischer, Apr 04 2012


LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Index entries for characteristic functions


FORMULA

a(A006995(n)) = 1; a(A154809(n)) = 0.  Reinhard Zumkeller, Oct 21 2011
a(n) = if A030101(n) = n then 1, otherwise 0.  Reinhard Zumkeller, Jan 17 2012
a(n) = 1  (A206916(n)  A206915(n)).  Hieronymus Fischer, Feb 18 2012
G.f.: g(x) = 1 + x + x^3 + Sum{j>=1} x^(3*2^j)*(f_j(x)+f_j(1/x)), where the f_j(x) are defined as follows:
f_1(x)=x, and for j > 1,
f_j(x) = x^3*Product_{k=1..floor((j1)/2)} (1+x^b(j,k)), where b(j,k) = 2^(floor((j1)/2)k)*((3+(1)^j)*2^(2*k+1)+4) for k > 1, and b(j,1) = (2+(1)^j)*2^(floor((j1)/2)+1). The first explicit terms of this g.f. are
g(x) = 1 + x + x^3 + (f_1(x) + f_1(1/x))*x^6 + (f_2(x) + f_2(1/x))*x^12 + (f_3(x)+f_3(1/x))*x^24 + (f_4(x) + f_4(1/x))*x^48 + (f_5(x) + f_5(1/x))*x^96 + ... = 1 + x + x^3 + (x+1/x)*x^6 + (x^3+1/x^3)*x^12 + (x^3*(1+x^4) + (1+1/x^4)/x^3)*x^24 + (x^3*(1+x^12) + (1+1/x^12)/x^3)*x^48 + (x^3*(1+x^8)(1+x^20) + (1+1/x^20)(1+1/x^8)/x^3)*x^96 + ...  Hieronymus Fischer, Apr 02 2012


EXAMPLE

a(3)=1, since 3 is binary palindromic;
a(4)=0, since 4 is not palindromic.


PROG

(Chipmunk BASIC v3.6.4(b8))
rem http://www.nicholson.com/rhn/basic/
for n=0 to 200
r$=""
s$=bin$(n)
for i=len(s$) to 1 step 1
r$=r$+mid$(s$, i, 1)
next i
if r$ = s$ then c=1 : else c=0
print str$(c)+", ";
next n
print
end
(Haskell)
a178225 n = fromEnum $ n == a030101 n  Reinhard Zumkeller, Oct 21 2011
(PARI) a(n) = my(b=binary(n)); b == Vecrev(b); \\ Michel Marcus, Feb 13 2019


CROSSREFS

Cf. A006995, A175096, A178226
Cf. A136522. See A206915 for the partial sums.
Sequence in context: A141735 A322585 A322860 * A264739 A257170 A073097
Adjacent sequences: A178222 A178223 A178224 * A178226 A178227 A178228


KEYWORD

base,easy,nonn


AUTHOR

Jeremy Gardiner, May 23 2010


STATUS

approved



