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.

A062843 Maximum number of ones in the representation of n in any base.

Original entry on oeis.org

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

Views

Author

Erich Friedman, Jul 21 2001

Keywords

Examples

			a(11)=3 since 11 in base 2 is 1011, containing 3 ones.
		

Programs

  • Maple
    seq(max(numboccur(convert(i,base,2),1), numboccur(convert(i,base,3),1), numboccur(convert(i,base,4),2), numboccur(convert(i,base,5),1), numboccur(convert(i,base,6),1), numboccur(convert(i,base,7),1), numboccur(convert(i,base,8),1), numboccur(convert(i,base,9),1), numboccur(convert(i,base,10),1), numboccur(convert(i,base,11),1), numboccur(convert(i,base,12),1), numboccur(convert(i,base,13),1), numboccur(convert(i,base,14),1), numboccur(convert(i,base,15),1), numboccur(convert(i,base,16),1), numboccur(convert(i,base,17),1)),i=1..200);
  • PARI
    ones(n,b)=my(s); while(n,if(n%b==1,s++);n\=b); s
    a(n)=if(n<3,return(1)); my(m=hammingweight(n),b=2); while(b++^(m-1)Charles R Greathouse IV, Mar 17 2013

Extensions

Maple code and more terms from Barbara Haas Margolius (b.margolius(AT)csuohio.edu), Oct 10 2001