Vyxal, 1716 bytes
ƛEDẊ²Ṡ√>∑;¦2Nȯ4NβƛEDẊ²Ṡ√>∑;¦÷$4*ε
Mostly a port of UnrelatedString's Jelly answer. There's got to be a wayThere's got to be a way to save a byte on the last bit -1 thanks to save a byte on the last bitUnrelatedString.
ƛ ; # Over 1...n
∑ # Count the number of
DẊ # Pairs
E # Of 1...2^m
²Ṡ√ # Whose squared sums, sqrt'd
> # Are less than
E # 2^m
¦ # Take the cumulative sum
2Nȯ÷ ε # TakeSubtract from the last two itemsitem
$4* 4Nβ # AndThe convertsecond-to-last fromitem basetimes -4