login
Numbers k such that the binary digits of k*(k-1) and k*(k+1) have the same numbers of 0's and the same number of 1's.
2

%I #16 May 27 2023 17:24:35

%S 7,15,25,31,43,48,54,63,80,84,87,110,113,127,142,144,147,162,171,172,

%T 177,183,185,197,199,203,216,217,221,226,227,232,234,238,243,255,275,

%U 281,290,301,303,308,317,322,323,329,340,343,349,355,367,370,377,389,391,402,411,418,423,426,427,432

%N Numbers k such that the binary digits of k*(k-1) and k*(k+1) have the same numbers of 0's and the same number of 1's.

%C k such that A023416(k*(k-1)) = A023416(k*(k+1)) and A000120(k*(k-1))=A000120(k*(k+1)).

%C Either of A023416 and A000120 could be replaced by A070939 in this condition.

%H Robert Israel, <a href="/A334798/b334798.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3)=25 is in the sequence because 25*24=600=1001011000_2 and 25*26=650=1010001010_2 both have 6 binary digits 0 and 4 binary digits 1.

%p filter:= proc(n) local A,B;

%p A:= convert(n*(n-1),base,2);

%p B:= convert(n*(n+1),base,2);

%p nops(A)=nops(B) and convert(A,`+`)=convert(B,`+`)

%p end proc:

%p select(filter, [$1..1000]);

%t sn01Q[k_]:=DigitCount[k(k-1),2,0]==DigitCount[k(k+1),2,0]&&DigitCount[k(k-1),2,1] == DigitCount[ k(k+1),2,1]; Select[Range[500],sn01Q] (* _Harvey P. Dale_, May 27 2023 *)

%o (PARI) isok(k) = vecsort(binary(k*(k+1))) == vecsort(binary(k*(k-1))); \\ _Michel Marcus_, May 12 2020

%Y Cf. A000120, A023416, A070939, A181775.

%Y Includes terms >= 7 of A000225.

%K nonn,base

%O 1,1

%A _Robert Israel_, May 11 2020