login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A086849 Sum of first n nonsquares. 10

%I #29 Mar 31 2022 12:59:25

%S 2,5,10,16,23,31,41,52,64,77,91,106,123,141,160,180,201,223,246,270,

%T 296,323,351,380,410,441,473,506,540,575,612,650,689,729,770,812,855,

%U 899,944,990,1037,1085,1135,1186,1238,1291,1345,1400,1456,1513,1571,1630

%N Sum of first n nonsquares.

%H Reinhard Zumkeller, <a href="/A086849/b086849.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000217(A000037(n)) - A000330(A000196(A000037(n))).

%F From _Jonathan Vos Post_, Aug 28 2005: (Start)

%F a(n) = Sum_{i=1..n} A000037(i).

%F a(n) = Sum_{i=1..n} (i + floor(1/2 + sqrt(i))).

%F a(n) = A000217(A000037(n)) -(1/3)*(2*A000196(n)+1)*A000217(A000196(A000037(n))). (End)

%F a(n) = floor(1/2 + (n + sqrt(n))*(n/2 + sqrt(n)/6 + 1/3) - (floor(1/2 + sqrt(n)) - sqrt(n))^2*sqrt(n)). - _Graeme McRae_, Aug 28 2007

%F a(n) = n^2/2 + 2n*sqrt(n)/3 + O(n). - _Charles R Greathouse IV_, Aug 28 2016

%t Accumulate[Table[n + Round[Sqrt[n]], {n, 120}]] (* _Vladimir Joseph Stephan Orlovsky_, Jul 08 2011 *)

%o (Haskell)

%o a086849 n = a086849_list !! (n-1)

%o a086849_list = scanl1 (+) a000037_list

%o -- _Reinhard Zumkeller_, Oct 26 2015

%o (PARI) a(n)=my(k=n+(sqrtint(4*n)+1)\2,s=sqrtint(k)); k*(k+1)/2 - s*(s+1)*(2*s+1)/6 \\ _Charles R Greathouse IV_, Aug 28 2016

%o (Python)

%o from math import isqrt

%o def A086849(n): return (m:= n + isqrt(n + isqrt(n)))*(m + 1)//2 - (k:=isqrt(m))*(k + 1)*(2*k + 1)//6 # _Chai Wah Wu_, Mar 31 2022

%Y Cf. A000037, A000196, A000217, A000330, A048395.

%K nonn,easy

%O 1,1

%A _Reinhard Zumkeller_, Aug 18 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 02:16 EDT 2024. Contains 371264 sequences. (Running on oeis4.)