login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 23

%I #57 Sep 04 2022 14:42:06

%S 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,

%T 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,

%U 1,1,2,0,1,1,1,1,1,1,0,2,0,1,2,0,2,1,0

%N 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.

%C wt(k) is also called bitcount(k).

%C a(n) = number of times n occurs in A092391.

%C The first 2 occurs at n=5 (as we have two solutions A092391(3) = A092391(4) = 5).

%C The first 3 occurs at n=129 (as we have three solutions A092391(123) = A092391(124) = A092391(128) = 129).

%C The first 4 occurs at n=4102, where we have solutions A092391(4091) = A092391(4092) = A092391(4099) = A092391(4100) = 4102.

%C A number with five inverses was found by _Donovan Johnson_, Oct 19 2013, namely 2^136 + 6, which has inverses 2^136 - 129, 2^136 - 125, 2^136 - 124, 2^136 + 3, 2^136 + 4. - _N. J. A. Sloane_, Oct 20 2013.

%C Comment from _Donovan Johnson_, Oct 22 2013 (Start):

%C I wrote a new program that is more efficient than the previous one I used. The new program only checks the last 20 bits for each inverse because when the inverse is < 2^m, all of the most significant bits are 1's. When the inverse is >= 2^m, the most significant bits are a 1 followed by all 0's.

%C Here is the smallest I found:

%C 5 inverses: 2^136 + 6 (same as what I sent previously)

%C 6 inverses: 2^260 + 130

%C 7 inverses: 2^4233 + 130

%C 8 inverses: 2^8206 + 4103

%C I have checked m values (exponents) up to 10^6 and did not find a solution for 9 inverses. (End)

%C For n>=1, a(2^n) = a(n-1) since an integer k = m is a solution to n-1 = m + wt(m) if and only if k = 2^n - 1 - m is a solution to 2^n = k + wt(k). - _Max Alekseyev_, Feb 23 2021

%H Antti Karttunen, <a href="/A228085/b228085.txt">Table of n, a(n) for n = 0..8191</a>

%H Max A. Alekseyev and N. J. A. Sloane, <a href="https://arxiv.org/abs/2112.14365">On Kaprekar's Junction Numbers</a>, arXiv:2112.14365, 2021; Journal of Combinatorics and Number Theory, 2022 (to appear).

%H <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a>

%p For Maple code see A230091. - _N. J. A. Sloane_, Oct 10 2013

%p # Find all inverses of m under x -> x + wt(x) - _N. J. A. Sloane_, Oct 19 2013

%p 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;

%p F:=proc(m) local ans,lb,n,i;

%p lb:=m-ceil(log(m+1)/log(2)); ans:=[];

%p for n from max(1,lb) to m do if (n+wt(n)) = m then ans:=[op(ans),n]; fi; od:

%p [seq(ans[i],i=1..nops(ans))];

%p end;

%t nmax = 8191; Clear[a]; a[_] = 0;

%t Scan[Set[a[#[[1]]], #[[2]]]&, Tally[Table[n + DigitCount[n, 2, 1], {n, 0, nmax}]]];

%t a /@ Range[0, nmax] (* _Jean-François Alcover_, Oct 29 2019 *)

%t 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];

%t a /@ Range[0, 100] (* _Jean-François Alcover_, Nov 28 2020 *)

%o (Haskell)

%o a228085 n = length $ filter ((== n) . a092391) [n - a070939 n .. n]

%o -- _Reinhard Zumkeller_, Oct 13 2013

%Y A010061 gives the position of zeros, A228082 the positions of nonzeros, A228088 the positions of ones. Cf. A000120, A010062, A092391, A228086, A228087, A228091 (positions of 2's), A227643, A230058, A230092 (positions of 3's), A230093, A227915 (positions of 4's), A070939.

%K nonn,base

%O 0,6

%A _Antti Karttunen_, Aug 09 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 12:36 EDT 2024. Contains 371711 sequences. (Running on oeis4.)