A039004 Numbers whose base-4 representation has the same number of 1's and 2's.
0, 3, 6, 9, 12, 15, 18, 24, 27, 30, 33, 36, 39, 45, 48, 51, 54, 57, 60, 63, 66, 72, 75, 78, 90, 96, 99, 102, 105, 108, 111, 114, 120, 123, 126, 129, 132, 135, 141, 144, 147, 150, 153, 156, 159, 165, 177, 180, 183, 189, 192, 195, 198, 201, 204, 207, 210, 216, 219
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
Crossrefs
A subset of A001969 (evil numbers).
A base-2 version is A031443 (digitally balanced numbers).
Positions of first appearances are A086893.
The version for standard compositions is A344619.
A003714 lists numbers with no successive binary indices.
A011782 counts compositions.
A030190 gives the binary expansion of each nonnegative integer.
A070939 gives the length of an integer's binary expansion.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A101211 lists run-lengths in binary expansion:
- row-lengths: A069010
- reverse: A227736
- ones only: A245563
A138364 counts compositions with alternating sum 0:
- complement: A058622
A328594 lists numbers whose binary expansion is aperiodic.
A345197 counts compositions by length and alternating sum.
Programs
-
Fortran
c See link in A139351.
-
Maple
N:= 1000: # to get all terms up to N, which should be divisible by 4 B:= Array(0..N-1): d:= ceil(log[4](N)); S:= Array(0..N-1,[seq(op([0,1,-1,0]),i=1..N/4)]): for i from 1 to d do B:= B + S; S:= Array(0..N-1,i-> S[floor(i/4)]); od: select(t -> B[t]=0, [$0..N-1]); # Robert Israel, Jun 24 2015
-
Mathematica
ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Select[Range[0,100],ats[IntegerDigits[#,2]]==0&] (* Gus Wiseman, Jul 28 2021 *)
-
PARI
for(n=0,219,if(sum(i=1,length(binary(n)),(-1)^i*component(binary(n),i))==0,print1(n,",")))
Formula
Conjecture: there is a constant c around 5 such that a(n) is asymptotic to c*n. - Benoit Cloitre, Nov 24 2002
That conjecture is false. The number of members of the sequence from 0 to 4^d-1 is binomial(2d,d) which by Stirling's formula is asymptotic to 4^d/sqrt(Pi*d). If Cloitre's conjecture were true we would have 4^d-1 asymptotic to c*4^d/sqrt(Pi*d), a contradiction. - Robert Israel, Jun 24 2015
Comments