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.

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

This page as a plain text file.
%I A049445 #83 Jan 05 2025 19:51:35
%S A049445 1,2,4,6,8,10,12,16,18,20,21,24,32,34,36,40,42,48,55,60,64,66,68,69,
%T A049445 72,80,81,84,92,96,108,110,115,116,120,126,128,130,132,136,138,144,
%U A049445 155,156,160,162,168,172,180,184,185,192,204,205,212,216,220,222,228
%N A049445 Numbers k with the property that the number of 1's in binary expansion of k (see A000120) divides k.
%C A049445 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
%C A049445 A199238(a(n)) = 0. - _Reinhard Zumkeller_, Nov 04 2011
%H A049445 Indranil Ghosh, <a href="/A049445/b049445.txt">Table of n, a(n) for n = 1..20000</a> (first 1000 terms from T. D. Noe)
%H A049445 Paul Dalenberg and Tom Edgar, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/56-2.html">Consecutive factorial base Niven numbers</a>, Fibonacci Quarterly, Vol. 56, No. 2 (2018), pp. 163-166.
%H A049445 Jean-Marie De Koninck, Nicolas Doyon and Imre Kátai, <a href="https://eudml.org/doc/278575">On the counting function for the Niven numbers</a>, Acta Arithmetica, Vol. 106, No. 3 (2003), pp. 265-275.
%F A049445 {k : A000120(k) | k}. - _R. J. Mathar_, Mar 03 2008
%F A049445 a(n) seems to be asymptotic to c*n*log(n) where 0.7 < c < 0.8. - _Benoit Cloitre_, Jan 22 2003
%F A049445 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
%F A049445 {a(n)} = {k : A199238(k) = 0}. - _M. F. Hasler_, Oct 09 2012
%F A049445 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
%e A049445 20 is in the sequence because 20 is written 10100 in binary and 1 + 1 = 2, which divides 20.
%e A049445 21 is in the sequence because 21 is written 10101 in binary and 1 + 1 + 1 = 3, which divides 21.
%e A049445 22 is not in the sequence because 22 is written 10110 in binary 1 + 1 + 1 = 3, which does not divide 22.
%p A049445 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
%t A049445 binHarshadQ[n_] := Divisible[n, Count[IntegerDigits[n, 2], 1]]; Select[Range[228], binHarshadQ] (* _Jean-François Alcover_, Dec 01 2011 *)
%t A049445 Select[Range[300],Divisible[#,DigitCount[#,2,1]]&] (* _Harvey P. Dale_, Mar 20 2016 *)
%o A049445 (PARI) for(n=1,1000,b=binary(n);l=length(b); if(n%sum(i=1,l, component(b,i))==0,print1(n,",")))
%o A049445 (PARI) is_A049445(n)={n%norml2(binary(n))==0} \\ _M. F. Hasler_, Oct 09 2012
%o A049445 (PARI) isok(n) = ! (n % hammingweight(n)); \\ _Michel Marcus_, Feb 10 2016
%o A049445 (Haskell)
%o A049445 a049445 n = a049445_list !! (n-1)
%o A049445 a049445_list = map (+ 1) $ elemIndices 0 a199238_list
%o A049445 -- _Reinhard Zumkeller_, Nov 04 2011
%o A049445 (Python)
%o A049445 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
%Y A049445 Cf. A000120, A005349, A199238.
%K A049445 nonn,easy,nice,base
%O A049445 1,2
%A A049445 _N. J. A. Sloane_
%E A049445 More terms from _Michael Somos_
%E A049445 Edited by _N. J. A. Sloane_, Oct 07 2005 and May 16 2008