OFFSET
0,4
COMMENTS
This sequence shares graphical features with A286327.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
FORMULA
a(n) = 1 iff n is a power of 2.
EXAMPLE
For n=42:
- the binary representation of 42 is "101010",
- there are 7 ways to split it:
- "" and "101010": x=0 and y=42: 0^2 + 42^2 = 1764,
- "1" and "01010": x=1 and y=10: 1^2 + 10^2 = 101,
- "10" and "1010": x=2 and y=10: 2^2 + 10^2 = 104,
- "101" and "010": x=5 and y=2: 5^2 + 2^2 = 29,
- "1010" and "10": x=10 and y=2: 10^2 + 2^2 = 104,
- "10101" and "0": x=21 and y=0: 21^2 + 0^2 = 441,
- "101010" and "": x=42 and y=0: 42^2 + 0^2 = 1764,
- hence a(42) = 29.
MATHEMATICA
Table[Min[Total[#^2]&/@Table[FromDigits[#, 2]&/@TakeDrop[IntegerDigits[n, 2], d], {d, 0, IntegerLength[n, 2]}]], {n, 0, 80}] (* Harvey P. Dale, Mar 03 2023 *)
PROG
(PARI) a(n) = my (v=oo, b=binary(n)); for (w=0, #b, v=min(v, fromdigits(b[1..w], 2)^2 + fromdigits(b[w+1..#b], 2)^2)); v
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Aug 25 2019
STATUS
approved