Jelly, (削除) 21 (削除ここまで) (削除) 13 (削除ここまで) (削除) 12 (削除ここまで) 11 bytes
×ばつ4
How it works
×ばつ4 Main link. Argument: r
R Range; yield [1, 2, ..., r].
2 Square; yield [12, 22, ..., r2].
2 Square; yield r2.
ạ Absolute difference; yield [r2-12, r2-22, ..., r2-r2].
Æ2 Test if each of the differences is a perfect square.
S Sum, counting the number of perfect squares and thus the integer
solutions of the equation x2 + y2 = r2 with x > 0 and y ≥ 0.
Ḥ Un-halve; yield 2r.
ạ Subtract the result to the left from the result to the right.
×ばつ4 Multiply by 4.
Jelly, (削除) 21 (削除ここまで) (削除) 13 (削除ここまで) (削除) 12 (削除ここまで) 11 bytes
×ばつ4
How it works
×ばつ4 Main link. Argument: r
R Range; yield [1, 2, ..., r].
2 Square; yield [12, 22, ..., r2].
2 Square; yield r2.
ạ Absolute difference; yield [r2-12, r2-22, ..., r2-r2].
Æ2 Test if each of the differences is a perfect square.
S Sum, counting the number of perfect squares and thus the integer
solutions of the equation x2 + y2 = r2 with x > 0 and y ≥ 0.
Ḥ Un-halve; yield 2r.
ạ Subtract the result to the left from the result to the right.
×ばつ4 Multiply by 4.