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.

A161765 a(n) is the smallest multiple of {the number of 1's in the binary representation of n} that is >= n.

Original entry on oeis.org

1, 2, 4, 4, 6, 6, 9, 8, 10, 10, 12, 12, 15, 15, 16, 16, 18, 18, 21, 20, 21, 24, 24, 24, 27, 27, 28, 30, 32, 32, 35, 32, 34, 34, 36, 36, 39, 39, 40, 40, 42, 42, 44, 45, 48, 48, 50, 48, 51, 51, 52, 54, 56, 56, 55, 57, 60, 60, 60, 60, 65, 65, 66, 64, 66, 66, 69, 68, 69, 72, 72, 72
Offset: 1

Views

Author

Leroy Quet, Jun 18 2009

Keywords

Examples

			11 (decimal) in binary is 1011. There are three 1's. Because 12 is the smallest multiple of 3 that is >= 11, then a(11) = 12.
		

Crossrefs

Programs

  • Maple
    a := proc (n) local n2, s, j: n2 := convert(n, base, 2): s := add(n2[i], i = 1 .. nops(n2)): for j while j*s < n do end do: j*s end proc: seq(a(n), n = 1 .. 80); # Emeric Deutsch, Jun 24 2009
  • Mathematica
    Table[d=DigitCount[n,2,1];d*Ceiling[n/d],{n,80}] (* Harvey P. Dale, Aug 23 2013 *)
  • PARI
    a(n) = my(nb = hammingweight(n)); nb*ceil(n/nb); \\ Michel Marcus, Nov 11 2018

Formula

a(n) = A000120(n)*ceiling(n/A000120(n)). - Michel Marcus, Nov 11 2018

Extensions

Extended by Emeric Deutsch, Jun 24 2009