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.

A359402 Numbers whose binary expansion and reversed binary expansion have the same sum of positions of 1's, where positions in a sequence are read starting with 1 from the left.

This page as a plain text file.
%I A359402 #12 Jan 08 2023 01:16:26
%S A359402 0,1,3,5,7,9,15,17,21,27,31,33,45,51,63,65,70,73,78,85,93,99,107,119,
%T A359402 127,129,150,153,165,189,195,219,231,255,257,266,273,282,294,297,310,
%U A359402 313,325,334,341,350,355,365,371,381,387,397,403,413,427,443,455,471
%N A359402 Numbers whose binary expansion and reversed binary expansion have the same sum of positions of 1's, where positions in a sequence are read starting with 1 from the left.
%C A359402 Also numbers whose binary expansion and reversed binary expansion have the same sum of partial sums.
%C A359402 Also numbers whose average position of a 1 in their binary expansion is (c+1)/2, where c is the number of digits.
%C A359402 Conjecture: Also numbers whose binary expansion has as least squares fit a line of zero slope, counted by A222955.
%F A359402 A230877(a(n)) = A029931(a(n)).
%e A359402 The binary expansion of 70 is (1,0,0,0,1,1,0), with positions of 1's {1,5,6}, while the reverse positions are {2,3,7}. Both sum to 12, so 70 is in the sequence.
%t A359402 Select[Range[0,100],#==0||Mean[Join@@Position[IntegerDigits[#,2],1]]==(IntegerLength[#,2]+1)/2&]
%o A359402 (Python)
%o A359402 from functools import reduce
%o A359402 from itertools import count, islice
%o A359402 def A359402_gen(startvalue=0): # generator of terms
%o A359402     return filter(lambda n:(r:=reduce(lambda c, d:(c[0]+d[0]*(e:=int(d[1])),c[1]+e),enumerate(bin(n)[2:],start=1),(0,0)))[0]<<1==(n.bit_length()+1)*r[1],count(max(startvalue,0)))
%o A359402 A359402_list = list(islice(A359402_gen(),30)) # _Chai Wah Wu_, Jan 08 2023
%Y A359402 Binary words of this type appear to be counted by A222955.
%Y A359402 For greater instead of equal sums we have A359401.
%Y A359402 These are the indices of 0's in A359495.
%Y A359402 A030190 gives binary expansion, reverse A030308.
%Y A359402 A048793 lists partial sums of reversed standard compositions, sums A029931.
%Y A359402 A070939 counts binary digits, 1's A000120.
%Y A359402 A326669 lists numbers with integer mean position of a 1 in binary expansion.
%Y A359402 Cf. A051293, A053632, A231204, A291166, A304818, A318283, A326672, A326673, A358134, A359042.
%K A359402 nonn
%O A359402 1,3
%A A359402 _Gus Wiseman_, Jan 05 2023