login
a(n) = the largest square that when represented in binary is a substring within the binary representation of n.
3

%I #19 Feb 17 2018 12:27:01

%S 1,1,1,4,1,1,1,4,9,1,1,4,1,1,1,16,4,9,9,4,1,1,1,4,25,1,1,4,1,1,1,16,

%T 16,4,4,36,9,9,9,4,9,1,1,4,1,1,1,16,49,25,25,4,1,1,1,4,25,1,1,4,1,1,1,

%U 64,16,16,16,4,4,4,4,36,36,9,9,9,9,9,9,16,81,9,9,4,1,1,1,4,25,1,1,4,1,1,1,16,16,49,49,100,25

%N a(n) = the largest square that when represented in binary is a substring within the binary representation of n.

%C a(n) = A162401(n)^2.

%H Michael De Vlieger, <a href="/A162400/b162400.txt">Table of n, a(n) for n = 1..4096</a>

%F From _David A. Corneth_, Nov 04 2017: (Start)

%F a(n^2) = n^2

%F a(4*n) = 4*a(n)

%F a(4*n + 2) = a(2*n + 1). (End)

%e a(8) = 4 since 8 = binary "1000" and the largest square less than or equal to 8, that of 4 = binary "100" appears as the first three bits of "1000". - _Michael De Vlieger_, Nov 04 2017

%t Table[Block[{k = n, s}, While[SequenceCount[#, IntegerDigits[Set[s, k^2], 2]] == 0, k--]; s] &@ IntegerDigits[n, 2], {n, 101}] (* _Michael De Vlieger_, Nov 04 2017 *)

%Y Cf. A162401.

%K base,nonn

%O 1,4

%A _Leroy Quet_, Jul 02 2009

%E Corrected and extended by _Sean A. Irvine_, Dec 05 2010