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.

A348515 a(n) = Sum_{d|n, d <= sqrt(n)} (-1)^(n/d + 1).

This page as a plain text file.
%I A348515 #53 Aug 21 2025 12:31:51
%S A348515 1,-1,1,-2,1,0,1,-2,2,0,1,-3,1,0,2,-3,1,-1,1,-1,2,0,1,-4,2,0,2,-1,1,
%T A348515 -2,1,-3,2,0,2,-3,1,0,2,-4,1,0,1,-1,3,0,1,-5,2,-1,2,-1,1,0,2,-4,2,0,1,
%U A348515 -4,1,0,3,-4,2,0,1,-1,2,-2,1,-4,1,0,3,-1,2,0,1,-5
%N A348515 a(n) = Sum_{d|n, d <= sqrt(n)} (-1)^(n/d + 1).
%H A348515 Michel Marcus, <a href="/A348515/b348515.txt">Table of n, a(n) for n = 1..10000</a>
%F A348515 G.f.: Sum_{k>=1} (-1)^(k + 1) * x^(k^2) / (1 + x^k).
%F A348515 a(n) = 1 iff n = 1 or n is an odd prime (A006005). - _Bernard Schott_, Nov 22 2021
%F A348515 a(n) = A258998(n) - A348951(n). - _Ridouane Oudra_, Aug 21 2025
%t A348515 Table[DivisorSum[n, (-1)^(n/# + 1) &, # <= Sqrt[n] &], {n, 1, 80}]
%t A348515 nmax = 80; CoefficientList[Series[Sum[(-1)^(k + 1) x^(k^2)/(1 + x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
%o A348515 (PARI) A348515(n) = sumdiv(n,d,if((d*d)<=n,(-1)^(1 + (n/d)),0)); \\ _Antti Karttunen_, Nov 05 2021
%o A348515 (Python)
%o A348515 from sympy import divisors
%o A348515 def a(n): return sum((-1)**(n//d + 1) for d in divisors(n) if d*d <= n)
%o A348515 print([a(n) for n in range(1, 81)]) # _Michael S. Branicky_, Nov 22 2021
%Y A348515 Cf. A038548, A048272, A113652, A228441, A305152, A333781, A348660, A348951, A348952, A258998.
%K A348515 sign
%O A348515 1,4
%A A348515 _Ilya Gutkovskiy_, Nov 04 2021