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.

A144079 a(n) = the number of digits in the binary representation of n that equal the corresponding digit in the binary reversal of n. (I.e., a(n) = number of 0's in n XOR A030101(n).)

Original entry on oeis.org

1, 0, 2, 1, 3, 1, 3, 2, 4, 0, 2, 0, 2, 2, 4, 3, 5, 1, 3, 3, 5, 1, 3, 1, 3, 3, 5, 1, 3, 3, 5, 4, 6, 2, 4, 2, 4, 0, 2, 2, 4, 0, 2, 4, 6, 2, 4, 2, 4, 4, 6, 0, 2, 2, 4, 0, 2, 2, 4, 2, 4, 4, 6, 5, 7, 3, 5, 3, 5, 1, 3, 5, 7, 3, 5, 3, 5, 1, 3, 3, 5, 1, 3, 5, 7, 3, 5, 3, 5, 1, 3, 5, 7, 3, 5, 3, 5, 5, 7, 1, 3, 3, 5, 3, 5
Offset: 1

Views

Author

Leroy Quet, Sep 09 2008

Keywords

Comments

A144078(n) + a(n) = A070939(n), the number of binary digits in n.

Examples

			20 in binary is 10100. Compare this with its digit reversal, 00101. XOR each pair of corresponding digits: 1 XOR 0 = 1, 0 XOR 0 = 0, 1 XOR 1 = 0, 0 XOR 0 = 0, 0 XOR 1 = 1. There are three bit pairs that contain the same values, so a(20) = 3.
		

Crossrefs

Programs

  • Maple
    A144079 := proc(n) local a,dgs,i; a := 0 ; dgs := convert(n,base,2) ; for i from 1 to nops(dgs) do if op(i,dgs)+op(-i,dgs) <> 1 then a := a+1 ; fi; od; RETURN(a) ; end: for n from 1 to 240 do printf("%d,",A144079(n)) ; od: # R. J. Mathar, Sep 14 2008
  • Mathematica
    Table[With[{c=IntegerDigits[n,2]},Count[BitXor[c,Reverse[c]],0]],{n,110}] (* Harvey P. Dale, Sep 03 2015 *)

Extensions

More terms from R. J. Mathar, Sep 14 2008