A162401 a(n) is the largest integer whose square, when represented in binary, is a substring within the binary representation of n.
1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 2, 1, 1, 1, 4, 2, 3, 3, 2, 1, 1, 1, 2, 5, 1, 1, 2, 1, 1, 1, 4, 4, 2, 2, 6, 3, 3, 3, 2, 3, 1, 1, 2, 1, 1, 1, 4, 7, 5, 5, 2, 1, 1, 1, 2, 5, 1, 1, 2, 1, 1, 1, 8, 4, 4, 4, 2, 2, 2, 2, 6, 6, 3, 3, 3, 3, 3, 3, 4, 9, 3, 3, 2, 1, 1, 1, 2, 5, 1, 1, 2, 1, 1, 1, 4, 4, 7, 7
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..16384 (first 10000 terms from Robert G. Wilson v)
Crossrefs
Cf. A162400.
Programs
-
Mathematica
f[n_] := Block[{k = Floor@ Sqrt@ n, s = ToString@ FromDigits@ IntegerDigits[n, 2]}, While[ StringPosition[s, ToString@ FromDigits@ IntegerDigits[k^2, 2]] == {}, k-- ]; k]; Array[f, 105] (* Robert G. Wilson v, Jul 16 2009 *)
Extensions
a(16) correction and more terms from Robert G. Wilson v, Jul 16 2009
Comments