A228085 a(n) = number of distinct k which satisfy n = k + wt(k), where wt(k) (A000120) gives the number of 1's in binary representation of a nonnegative integer k.
1, 0, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, 1, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 2, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0
Offset: 0
Links
- Antti Karttunen, Table of n, a(n) for n = 0..8191
- Max A. Alekseyev and N. J. A. Sloane, On Kaprekar's Junction Numbers, arXiv:2112.14365, 2021; Journal of Combinatorics and Number Theory 12:3 (2022), 115-155.
- Index entries for Colombian or self numbers and related sequences
Crossrefs
Programs
-
Haskell
a228085 n = length $ filter ((== n) . a092391) [n - a070939 n .. n] -- Reinhard Zumkeller, Oct 13 2013
-
Maple
For Maple code see A230091. - N. J. A. Sloane, Oct 10 2013 # Find all inverses of m under x -> x + wt(x) - N. J. A. Sloane, Oct 19 2013 A000120 := proc(n) local w, m, i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end: wt := A000120; F:=proc(m) local ans,lb,n,i; lb:=m-ceil(log(m+1)/log(2)); ans:=[]; for n from max(1,lb) to m do if (n+wt(n)) = m then ans:=[op(ans),n]; fi; od: [seq(ans[i],i=1..nops(ans))]; end;
-
Mathematica
nmax = 8191; Clear[a]; a[_] = 0; Scan[Set[a[#[[1]]], #[[2]]]&, Tally[Table[n + DigitCount[n, 2, 1], {n, 0, nmax}]]]; a /@ Range[0, nmax] (* Jean-François Alcover, Oct 29 2019 *) a[n_] := Module[{k, cnt = 0}, For[k = n - Floor[Log[2, n]] - 1, k < n, k++, If[n == k + DigitCount[k, 2, 1], cnt++]]; cnt]; a /@ Range[0, 100] (* Jean-François Alcover, Nov 28 2020 *)
Comments