%I #44 Sep 08 2022 08:46:21
%S 1,2,4,6,8,10,12,16,18,20,24,32,34,36,40,42,48,60,64,66,68,72,80,84,
%T 92,96,108,116,120,126,128,132,136,144,156,160,168,172,180,184,192,
%U 204,212,216,222,228,232,240,246,252,256,264,272,276,284,288,300,310
%N Numbers k such that, for any divisor d of k, the Hamming weight of d divides k.
%C The Hamming weight of a number is given by A000120.
%C This sequence is a binary variant of A285815.
%C This sequence is infinite as it contains all powers of 2 (A000079).
%C All terms belong to A049445.
%C If k belongs to the sequence, then 2*k belongs to the sequence.
%C All terms except 1 are even. - _Robert Israel_, Mar 05 2019
%H Amiram Eldar, <a href="/A306263/b306263.txt">Table of n, a(n) for n = 1..10000</a>
%e For n = 108:
%e - the divisors of 108 are 1, 2, 3, 4, 6, 9, 12, 18, 27, 36, 54, 108,
%e - the corresponding Hamming weights are 1, 1, 2, 1, 2, 2, 2, 2, 4, 2, 4, 4,
%e - they all divide 108,
%e - hence 108 belongs to the sequence.
%e For n = 98:
%e - the divisors of 98 are 1, 2, 7, 14, 49, 98,
%e - the correspond Hamming weights are 1, 1, 3, 3, 3, 3,
%e - 3 does not divide 98,
%e - hence 98 does not belong to the sequence.
%p filter:= proc(n) local F;
%p F:= map(convert,map(convert,numtheory:-divisors(n),base,2),`+`);
%p andmap(t -> n mod t = 0, F)
%p end proc:
%p select(filter, [$1..1000]); # _Robert Israel_, Mar 05 2019
%t Select[Range@ 310, With[{k = #}, AllTrue[Divisors@ k, Mod[k, DigitCount[#, 2, 1]] == 0 &]] &] (* _Michael De Vlieger_, Mar 05 2019 *)
%o (PARI) is(n) = fordiv(n,d,if (n%hammingweight(d), return (0))); return ( )
%o (Magma) [k:k in [1..310]| forall{d:d in Divisors(k)| k mod &+Intseq(d,2) eq 0}]; // _Marius A. Burtea_, Dec 30 2019
%Y Cf. A000079, A000120, A049445, A141586, A285815.
%Y Positions of zeros in A324393.
%K nonn,base
%O 1,2
%A _Rémy Sigrist_, Mar 02 2019
|