A162400 a(n) = the largest square that when represented in binary is a substring within the binary representation of n.
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, 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, 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
Offset: 1
Examples
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
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..4096
Crossrefs
Cf. A162401.
Programs
-
Mathematica
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 *)
Formula
From David A. Corneth, Nov 04 2017: (Start)
a(n^2) = n^2
a(4*n) = 4*a(n)
a(4*n + 2) = a(2*n + 1). (End)
Extensions
Corrected and extended by Sean A. Irvine, Dec 05 2010
Comments