login
a(n) = number of positive integers k, k <= n, where the number of one's in the binary representation of each k divides n.
2

%I #14 Jul 16 2023 02:07:21

%S 1,2,2,4,3,6,3,7,5,9,4,12,4,10,8,12,5,17,5,15,11,14,5,24,5,15,14,18,5,

%T 25,5,21,16,18,7,35,6,19,19,27,6,35,6,27,23,20,6,46,6,23,24,31,6,40,9,

%U 33,26,21,6,60,6,21,26,37,13,45,7,40,29,31,7,66,7,26,38,43,7,53,7,53,34

%N a(n) = number of positive integers k, k <= n, where the number of one's in the binary representation of each k divides n.

%H Amiram Eldar, <a href="/A138664/b138664.txt">Table of n, a(n) for n = 1..10000</a>

%e The integers 1 through 9 in binary are (1, 10, 11, 100, 101, 110, 111, 1000, 1001). So the numbers of 1's in these binary representations form the sequence (1,1,2,1,2,2,3,1,2) (the first 9 terms of sequence A000120, starting from A000120(1)). 9 is divisible by all the 1's (there are 4 of those) and by the one 3. So a(9) = 4+1 = 5.

%t a[n_] := Sum[Boole[Divisible[n, DigitCount[k, 2, 1]]], {k, 1, n}]; Array[a, 100] (* _Amiram Eldar_, Jul 16 2023 *)

%Y Cf. A138663, A000120.

%K nonn,base

%O 1,2

%A _Leroy Quet_, Mar 25 2008

%E Corrected and extended by _Sean A. Irvine_, Oct 12 2009