%I #34 Apr 15 2024 16:20:09
%S 4,5,7,14,79,831,6495,247614,7361278,743300286,121387475838
%N a(n) is the least number > 1 that needs n toggles in the trailing bits of its binary representation to become a square.
%H Michael S. Branicky, <a href="/A358701/a358701.go.txt">Go program.</a>
%H Code Golf StackExchange, <a href="https://codegolf.stackexchange.com/questions/170281/toggle-some-bits-and-get-a-square/">Toggle some bits and get a square</a>, coding challenge started by user Arnauld, Aug 18 2018.
%H Delbert L. Johnson, <a href="/A358701/a358701.cs.txt">C# program</a>
%e a(0) = 4 = 100 in binary, 0 toggled bits needed;
%e a(1) = 5 = 101_2, 1 toggled bit -> 100_2 = 4;
%e a(2) = 7 = 111_2, 2 toggled bits -> 100_2 = 4;
%e a(3) = 14 = 1110_2, 3 toggled bits -> 1001_2 = 9;
%e a(4) = 79 = 1001111_2, 4 toggled bits -> 1000000_2 = 64;
%e a(5) = 831 = 1100111111_2, 5 toggled bits -> 1100010000_2 = 784 = 28^2.
%o See Code Golf link. - _Arnauld Chevallier_, Aug 18 2018
%o (Go) // see linked program
%o (C#) // see linked program
%Y Cf. A000120, A000290, A001737, A159918.
%K nonn,base,hard,more
%O 0,1
%A _Hugo Pfoertner_, Dec 16 2022
%E a(9) from _Michael S. Branicky_, Dec 19 2022
%E a(10) from _Delbert L. Johnson_, Apr 13 2024
|