A360643 a(n) is the least A000120-perfect number (A175522) whose binary weight (A000120) is n, or 0 if no such number exists.
2, 0, 25, 169, 841, 95, 247, 943, 767, 5999, 6139, 16123, 30655, 90109, 122847, 245695, 522237, 1572591, 1966015, 3932095, 12582651, 28311519, 33423343, 100663023, 133693435, 402128831, 931135479, 1069547515, 1610612607, 11802771447, 12884901567, 25736249279
Offset: 1
Examples
a(1) = 2 since A000120(2) = 1 and A093653(2)/A000120(2) = 4/2 = 2. a(2) = 0 since there is no number m with binary weight 2 and with A093653(m) = 4. a(3) = 25 since A000120(25) = 3 and A093653(25)/A000120(25) = 6/3 = 2, and 25 is the least number with this property.
Programs
-
Mathematica
seq[len_, nmax_] := Module[{s = Table[-1, {len}], n = 3, c = 2, bw, dbw}, s[[1]] = 2; While[c < len && n <= nmax, bw = DigitCount[n, 2, 1]; If[bw <= len && s[[bw]] < 0, dbw = DivisorSum[n, DigitCount[#, 2, 1] &]; If[dbw == 2*bw, c++; s[[bw]] = n]]; n += 2]; s]; seq[16, 10^6]
-
PARI
lista(len, nmax) = {my(s = vector(len,i,-1), n = 3, c = 2, bw, dbw); s[1] = 2; while(c < len && n <= nmax, bw = hammingweight(n); if(bw <= len && s[bw] < 0, dbw = sumdiv(n, d, hammingweight(d)); if(dbw == 2*bw, c++; s[bw] = n)); n += 2); s};
Comments