[Solution] For n>1,
a(n)=a([2n])+(−1)2n(n+1),
we can derive that for n⩾1,
a(2n)a(2n+1)=a(n)+(−1)n(2n+1)=a(n)+(−1)n=a(n)+(−1)(2n+1)(n+1)=a(n)+(−1)n+1.
Assume that for n⩾2, the binary representation of n is
(α1α2⋯αl)2
where αi=0 or 1,i=1,2,⋯,l. Consider the l−1 pairs of digits
(α1,α2),(α2,α3),⋯,(αl−1,αl)
Let f(n) be the number of pairs where ak=ak+1, and g(n) be the number of pairs where ak=ak+1, for k=1,2,⋯,l−1. Clearly,
f(n)+g(n)=l−1
We will prove by induction that for n⩾2,
a(n)=f(n)−g(n)
In fact, a(2)=a(1)+(−1)1=−1.
a(3)=a(1)+(−1)2=1
Also, f(2)=0,g(2)=1,f(3)=1,g(3)=0. Therefore, (1) holds for n=2,3.
Assume that for some k⩾3, (1) holds for 2⩽n⩽k. Consider the case when n=k+1.
Let k+1=(α1α2⋯al)2,l⩾3. Then a(k+1)===a((α1α2⋯αl)2)a((α1α2⋯αl−1)2)+(−1)(α1α2⋯al−1)2+αlf((α1α2⋯αl−1)2)−g((α1α2⋯αl−1)2)+(−1)αl−1+αl
If αl−1=αl, then
f(k+1)=f((α1α2⋯αl−1)2)+1g(k+1)=g((α1α2⋯αl−1)2)
Thus,
a(k+1)=f((α1α2⋯αl−1)2)−g((α1α2⋯αl−1)2)+1=f(k+1)−g(k+1).
If αl−1=αl, then
f(k+1)=f((α1α2⋯αl−1)2)g(k+1)=g((α1α2⋯αl−1)2)+1
Thus,
a(k+1)=f((α1α2⋯αl−1)2)−g((α1α2⋯αl−1)2)−1=f(k+1)−g(k+1)
Therefore, (1) also holds for n=k+1.
(a) Since (1995)10=(11111001011)2, and by (1), a(n) reaches its maximum value 9 when n=(1111111111)2=1023, and its minimum value -10 when n=(10101010101)2=1365.
(b) Let n=(α1α2⋯αl)2,n⩾2. Then a(n)=0 if and only if f(n)=g(n). In this case,
l−1=f(n)+g(n)=2f(n)
is even, so l is odd.
For 2⩽n⩽1995, l can only be 3,5,7,9,11.
For a fixed l∈{3,5,7,9,11}. When 2l−1⩽n⩽2l−1, the binary representation of n is (α1α2⋯αl)2, and α1=1. Therefore, a(n)=0 if and only if exactly 2l−1 pairs (αk,αk+1) satisfy αk=αk+1. Thus, for 2l−1⩽n⩽2l−1, there are Cl−12l−1 values of a(n) that are 0. Therefore, for 2⩽n⩽211−1, the number of values of a(n) that are 0 is
C21+C42+C63+C84+C105=350 (terms).
For 1996⩽n⩽211−1, it is easy to see that a(n)=0 only for the values
(11111101010)2,(11111011010)2,(11111010110)2,
(11111010010)2,(11111010100)2.
These 5 values.
Thus, for 2⩽n⩽1995, there are 345 values of a(n) that are 0. Since a(1)=0, there are 346 values of a(n) that are 0 for n<1996.