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.

A271860 a(n) = -Sum_{i=1..n} (-1)^floor(n/i).

This page as a plain text file.
%I A271860 #30 Oct 23 2023 17:42:48
%S A271860 0,1,0,3,0,3,2,5,0,5,4,7,2,5,4,11,4,7,6,9,4,11,10,13,4,9,8,15,10,13,
%T A271860 12,15,6,13,12,19,12,15,14,21,12,15,14,17,12,23,22,25,12,17,16,23,18,
%U A271860 21,20,27,18,25,24,27,18,21,20,31,20,27,26,29,24,31,30
%N A271860 a(n) = -Sum_{i=1..n} (-1)^floor(n/i).
%H A271860 Seiichi Manyama, <a href="/A271860/b271860.txt">Table of n, a(n) for n = 0..10000</a>
%F A271860 a(2n) = 2*A075989(n) for n>0.
%F A271860 a(n) mod 2 = A000035(n).
%F A271860 a(n) = Sum_{k=1..n} (-1)^floor((n-k)/k). - _Wesley Ivan Hurt_, May 09 2021
%F A271860 G.f.: (1/(1 - x)) * Sum_{k>=1} x^k * (1 - x^k)/(1 + x^k). - _Seiichi Manyama_, Jun 06 2021
%p A271860 A271860:=n->-add((-1)^floor(n/i), i=1..n): seq(A271860(n), n=0..100);
%t A271860 Table[-Sum[(-1)^Floor[n/i], {i, n}], {n, 0, 100}]
%o A271860 (PARI) a(n) = -sum(i=1, n, (-1)^(n\i)); \\ _Michel Marcus_, Apr 16 2016
%o A271860 (PARI) my(N=99, x='x+O('x^N)); concat(0, Vec(sum(k=1, N, x^k*(1-x^k)/(1+x^k))/(1-x))) \\ _Seiichi Manyama_, Jun 06 2021
%o A271860 (Python)
%o A271860 from math import isqrt
%o A271860 def A271860(n): return (((t:=isqrt(m:=n>>1))**2<<1)-(s:=isqrt(n))**2+(sum(n//k for k in range(1,s+1))-(sum(m//k for k in range(1,t+1))<<1)<<1)<<1)-n # _Chai Wah Wu_, Oct 23 2023
%Y A271860 Column k=1 of A345033.
%Y A271860 Cf. A000035, A075989.
%K A271860 nonn,easy
%O A271860 0,4
%A A271860 _Wesley Ivan Hurt_, Apr 15 2016