A180416 Number of positive integers below 10^n, excluding perfect squares, which have a representation as a sum of 2 positive squares.
3, 33, 298, 2649, 23711, 215341, 1982296, 18447847, 173197435, 1637524156, 15570196516, 148735628858, 1426303768587, 13722207893214, 132387231596281, 1280309591127436
Offset: 1
Links
- Eric W. Weisstein: MathWorld -- Lagrange's Four-Square Theorem.
- Eric W. Weisstein: MathWorld -- Sum of Squares Function.
Programs
-
Maple
isA000415 := proc(n) local x ,y2; if issqr(n) then false; else for x from 1 do y2 := n-x^2 ; if y2 < x^2 then return false; elif issqr(y2) then return true; end if; end do ; end if; end proc: A180416 := proc(n) a := 0 ; for k from 2 to 10^n-1 do if isA000415(k) then a := a+1 ; end if; end do: a ; end proc: for n from 1 do print(A180416(n)) ; end do; # R. J. Mathar, Jan 20 2011
-
Mathematica
a[n_] := a[n] = Module[{k, xMax = Floor[Sqrt[10^n - 1]]}, Table[k = x^2 + y^2; If[IntegerQ[Sqrt[k]], Nothing, k], {x, 1, xMax}, {y, x, Floor[ Sqrt[10^n - 1 - x^2]]}] // Flatten // Union // Length]; Table[Print[n, " ", a[n]]; a[n], {n, 1, 8}] (* Jean-François Alcover, Oct 31 2020 *)
Formula
Extensions
a(6)-a(8) from Alois P. Heinz, Jan 20 2011
a(9)-a(10) from Donovan Johnson, Feb 04 2011
a(10) corrected and a(11)-a(16) from Hiroaki Yamanouchi, Jul 13 2014
Comments