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.

Showing 1-7 of 7 results.

A199262 Smallest m such that A199238(m) = n.

Original entry on oeis.org

1, 3, 11, 15, 59, 95, 223, 255, 1007, 1919, 4091, 6143, 16379, 28671, 61439, 65535, 261119, 516095, 1048571, 1966079, 4128767, 8380415, 16769023, 25165823, 67108799, 134184959, 268434431, 469762047, 1073741819, 2013265919, 4160749567, 4294967295, 17163091967
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 04 2011

Keywords

Comments

A199238(a(n)) = n and A199238(m) <> n for m < a(n).

Crossrefs

Cf. A138791.

Programs

  • Haskell
    a199262 n = (fromJust $ elemIndex n a199238_list) + 1

Extensions

a(24)-a(32) from Donovan Johnson, Nov 05 2011

A049445 Numbers k with the property that the number of 1's in binary expansion of k (see A000120) divides k.

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 12, 16, 18, 20, 21, 24, 32, 34, 36, 40, 42, 48, 55, 60, 64, 66, 68, 69, 72, 80, 81, 84, 92, 96, 108, 110, 115, 116, 120, 126, 128, 130, 132, 136, 138, 144, 155, 156, 160, 162, 168, 172, 180, 184, 185, 192, 204, 205, 212, 216, 220, 222, 228
Offset: 1

Views

Author

Keywords

Comments

If instead of base 2 we take base 10, then we have the so-called Harshad or Niven numbers (i.e., positive integers divisible by the sum of their digits; A005349). - Emeric Deutsch, Apr 11 2007
A199238(a(n)) = 0. - Reinhard Zumkeller, Nov 04 2011

Examples

			20 is in the sequence because 20 is written 10100 in binary and 1 + 1 = 2, which divides 20.
21 is in the sequence because 21 is written 10101 in binary and 1 + 1 + 1 = 3, which divides 21.
22 is not in the sequence because 22 is written 10110 in binary 1 + 1 + 1 = 3, which does not divide 22.
		

Crossrefs

Programs

  • Haskell
    a049445 n = a049445_list !! (n-1)
    a049445_list = map (+ 1) $ elemIndices 0 a199238_list
    -- Reinhard Zumkeller, Nov 04 2011
    
  • Maple
    a:=proc(n) local n2: n2:=convert(n,base,2): if n mod add(n2[i],i=1..nops(n2)) = 0 then n else fi end: seq(a(n),n=1..300); # Emeric Deutsch, Apr 11 2007
  • Mathematica
    binHarshadQ[n_] := Divisible[n, Count[IntegerDigits[n, 2], 1]]; Select[Range[228], binHarshadQ] (* Jean-François Alcover, Dec 01 2011 *)
    Select[Range[300],Divisible[#,DigitCount[#,2,1]]&] (* Harvey P. Dale, Mar 20 2016 *)
  • PARI
    for(n=1,1000,b=binary(n);l=length(b); if(n%sum(i=1,l, component(b,i))==0,print1(n,",")))
    
  • PARI
    is_A049445(n)={n%norml2(binary(n))==0} \\ M. F. Hasler, Oct 09 2012
    
  • PARI
    isok(n) = ! (n % hammingweight(n)); \\ Michel Marcus, Feb 10 2016
    
  • Python
    A049445 = [n for n in range(1,10**5) if not n % sum([int(d) for d in bin(n)[2:]])] # Chai Wah Wu, Aug 22 2014

Formula

{k : A000120(k) | k}. - R. J. Mathar, Mar 03 2008
a(n) seems to be asymptotic to c*n*log(n) where 0.7 < c < 0.8. - Benoit Cloitre, Jan 22 2003
Heuristically, c should be 1/(2*log(2)), since a random d-bit number should have probability approximately 2/d of being in the sequence. - Robert Israel, Aug 22 2014
{a(n)} = {k : A199238(k) = 0}. - M. F. Hasler, Oct 09 2012
De Koninck et al. (2003) proved that the number of base-b Niven numbers not exceeding x, N_b(x), is asymptotically equal to ((2*log(b)/(b-1)^2) * Sum_{j=1..b-1} gcd(j, b-1) + o(1)) * x/log(x). For b=2, N_2(n) ~ (2*log(2) + o(1)) * x/log(x). Therefore, the constant c mentioned above is indeed 1/(2*log(2)). - Amiram Eldar, Aug 16 2020

Extensions

More terms from Michael Somos
Edited by N. J. A. Sloane, Oct 07 2005 and May 16 2008

A070635 a(n) = n mod (sum of digits of n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 4, 3, 2, 1, 0, 9, 0, 0, 2, 3, 0, 4, 2, 0, 8, 7, 0, 3, 2, 3, 6, 3, 0, 7, 5, 3, 0, 1, 0, 1, 4, 0, 6, 3, 0, 10, 0, 3, 3, 5, 0, 5, 1, 9, 6, 3, 0, 5, 6, 0, 4, 10, 6, 2, 12, 9, 0, 7, 0, 3, 8, 3, 11, 7, 3, 15, 0, 0, 2, 6, 0, 7, 2, 12, 8
Offset: 1

Views

Author

Reinhard Zumkeller, May 13 2002

Keywords

Crossrefs

Cf. A007953.
Cf. A199238.

Programs

Formula

a(A005349(n)) = 0. - Reinhard Zumkeller, Mar 10 2008
A188641(n) = A000007(a(n)); a(A065877(n)) > 0. - Reinhard Zumkeller, Apr 07 2011
a(A138791(n)) = n and a(m) <> n for m < A138791(n). - Reinhard Zumkeller, Nov 07 2011

A161764 a(n) is the largest multiple of {the number of 1's in the binary representation of n} that is <= n.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Jun 18 2009

Keywords

Comments

a(n) = n - A199238(n). - Reinhard Zumkeller, Nov 04 2011

Examples

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

Crossrefs

Programs

  • Haskell
    a161764 n = n - a199238 n  -- Reinhard Zumkeller, Nov 04 2011
  • Maple
    a := proc (n) local n2, n1, j: n2 := convert(n, base, 2): n1 := add(n2[i], i = 1 .. nops(n2)): for j while j*n1 <= n do j*n1 end do end proc: seq(a(n), n = 1 .. 80); # Emeric Deutsch, Jun 26 2009
  • PARI
    a(n)=local(B=binary(n),w=B*vector(#B,x,1)~);n-n%w \\ Hagen von Eitzen, Jun 22 2009
    

Extensions

Extended by Hagen von Eitzen and Emeric Deutsch, Jun 26 2009

A265917 a(n) = floor(A070939(n)/A000120(n)) where A070939(n) is the binary length of n and A000120(n) is the binary weight of n.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Dec 18 2015

Keywords

Comments

1/a(n) gives a very rough approximation of the density of 1-bits in the binary representation (A007088) of n. This is 1 if more than half of the bits of n are 1. - Antti Karttunen, Dec 19 2015

Crossrefs

Programs

  • Mathematica
    Table[Floor[IntegerLength[n, 2]/Total@ IntegerDigits[n, 2]], {n, 120}] (* Michael De Vlieger, Dec 21 2015 *)
  • PARI
    a(n) = #binary(n)\hammingweight(n); \\ Michel Marcus, Dec 19 2015
  • Python
    for n in range(1, 88):
        print(str((len(bin(n))-2) // bin(n).count('1')), end=',')
    

A265918 a(n) = A070939(n) mod A000120(n), where A070939(n) is the binary length of n and A000120(n) is the binary weight of n.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 2, 1, 0, 0, 0, 2, 0, 2, 2, 1, 0, 2, 2, 1, 2, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 3, 2, 1, 1, 1, 3, 1, 3, 3
Offset: 1

Views

Author

Alex Ratushnyak, Dec 18 2015

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Mod[IntegerLength[n, 2], Total@ IntegerDigits[n, 2]], {n, 120}] (* Michael De Vlieger, Dec 21 2015 *)
  • PARI
    a(n) = #binary(n) % hammingweight(n); \\ Michel Marcus, Dec 19 2015
  • Python
    for n in range(1, 88): print((len(bin(n))-2) % bin(n).count('1'), end=', ')
    

A358139 Numbers k > 0 sorted by k/A000120(k) in increasing order. A000120 is the binary weight of k. If k/A000120(k) yields equal values, the smaller k will appear first.

Original entry on oeis.org

1, 3, 2, 7, 5, 6, 11, 15, 4, 13, 9, 14, 10, 23, 12, 31, 19, 27, 21, 29, 22, 30, 8, 25, 17, 26, 18, 28, 47, 39, 20, 63, 43, 55, 45, 46, 35, 59, 24, 61, 37, 62, 38, 51, 53, 54, 41, 42, 57, 58, 44, 60, 79, 95, 16, 49, 33, 50, 34, 52, 87, 71, 36, 127, 91, 111, 93, 56
Offset: 1

Views

Author

Thomas Scheuerle, Oct 31 2022

Keywords

Comments

A permutation of the positive integers.
This permutation satisfies a weak ordering: If b = a(c*d) and e = a(c) and f = a(d) then b > e and b > f with c,d > 1.

Crossrefs

Programs

  • PARI
    f(x) = x/hammingweight(x);
    cmpb(x, y) = my(hx=f(x), hy=f(y)); if (hx != hy, return(sign(hx-hy))); return(sign(x-y));
    lista(nn) = Vec(vecsort([1..2*nn], cmpb, 1), nn); \\ Michel Marcus, Nov 05 2022

Formula

a(2^n) = 2^(n+1) - 1.
abs(a(n)-n) < n.
Showing 1-7 of 7 results.