cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A132295 Sum of the nonsquare numbers not larger than n.

This page as a plain text file.
%I A132295 #19 Mar 05 2025 09:26:08
%S A132295 0,2,5,5,10,16,23,31,31,41,52,64,77,91,106,106,123,141,160,180,201,
%T A132295 223,246,270,270,296,323,351,380,410,441,473,506,540,575,575,612,650,
%U A132295 689,729,770,812,855,899,944,990,1037,1085,1085,1135,1186,1238,1291,1345
%N A132295 Sum of the nonsquare numbers not larger than n.
%H A132295 Jason Yuen, <a href="/A132295/b132295.txt">Table of n, a(n) for n = 1..10000</a>
%F A132295 Let r = floor(sqrt(n)). Then a(n) = n(n+1)/2 - r(r+1)(2r+1)/6.
%e A132295 Let n=5. The sum of the nonsquare numbers <= 5 is 2+3+5 = 10, the 5th entry in the sequence.
%t A132295 Table[Total[Select[Range[n],!IntegerQ[Sqrt[#]]&]],{n,54}] (* _James C. McMahon_, Mar 04 2025 *)
%o A132295 (PARI) sumNsq(n)= { for(x=1,n,r=floor(sqrt(x));sq=r*(r+1)*(2*r+1)/6;sn=x*(x+1)/2; print1(sn-sq",")) }
%o A132295 (Python)
%o A132295 from math import isqrt
%o A132295 def A000330(n): return n*(n+1)*(2*n+1)//6
%o A132295 def A132295(n): return n*(n+1)//2-A000330(isqrt(n)) # _Jason Yuen_, Jan 30 2024
%Y A132295 Cf. A000037, A000330, A086849.
%K A132295 nonn,easy
%O A132295 1,2
%A A132295 _Cino Hilliard_, Nov 07 2007
%E A132295 Definition corrected by _R. J. Mathar_, Sep 10 2016