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.

A386883 Define a sequence of rationals by f(0) = 0, thereafter f(n) = f(n-1) - 1/n if that is >= 0, otherwise f(n) = f(n-1) + 1/n; a(n) corresponds to the number of addition steps minus the number of subtraction steps involved in calculating f(n).

This page as a plain text file.
%I A386883 #14 Aug 25 2025 09:23:36
%S A386883 0,1,0,-1,0,-1,-2,-1,-2,-1,-2,-1,-2,-3,-2,-3,-2,-3,-2,-3,-2,-3,-2,-3,
%T A386883 -2,-3,-2,-3,-2,-3,-2,-3,-2,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,
%U A386883 -3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3,-4,-3
%N A386883 Define a sequence of rationals by f(0) = 0, thereafter f(n) = f(n-1) - 1/n if that is >= 0, otherwise f(n) = f(n-1) + 1/n; a(n) corresponds to the number of addition steps minus the number of subtraction steps involved in calculating f(n).
%C A386883 This sequence is unbounded below.
%C A386883 By contradiction:
%C A386883 - let M be the minimum value of the sequence and a(n) = M be the first occurrence of M in the sequence,
%C A386883 - as an addition step is always followed by a subtraction step, and the value M can only be followed by M+1, a(n+2*k) = M and a(n+2*k+1) = M+1 for any k >= 0,
%C A386883 - for any m >= n, f(m) = f(n) + Sum_{k = n+1..m} (-1)^(k-n-1) / k,
%C A386883 - as the alternating harmonic series converges to log(2), the sequence f will have a positive limit, say L > 0,
%C A386883 - hence for some m0 >= 0, f(m) > L/2 for any m >= m0,
%C A386883 - let k be such that n+2*k >= m0 and 1/(n+2*k+1) < L/2: f(n+2*k) > L/2, so f(n+2*k+1) = f(n+2*k) - 1/(n+2*k+1), and a(n+2*k+1) = a(n+2*k)-1 = M-1, a contradiction.
%H A386883 Rémy Sigrist, <a href="/A386883/b386883.txt">Table of n, a(n) for n = 0..10000</a>
%F A386883 a(n) = Sum_{k = 1..n} sign(A231692(n)/A231693(n) - A231692(n-1)/A231693(n-1)).
%e A386883 Sequence begins:
%e A386883   n   a(n)  f(n)-f(n-1)
%e A386883   --  ----  -----------
%e A386883    0     0  N/A
%e A386883    1     1  +1
%e A386883    2     0  -1/2
%e A386883    3    -1  -1/3
%e A386883    4     0  +1/4
%e A386883    5    -1  -1/5
%e A386883    6    -2  -1/6
%e A386883    7    -1  +1/7
%e A386883    8    -2  -1/8
%e A386883    9    -1  +1/9
%e A386883   10    -2  -1/10
%e A386883   11    -1  +1/11
%e A386883   12    -2  -1/12
%e A386883   13    -3  -1/13
%e A386883   14    -2  +1/14
%e A386883   15    -3  -1/15
%t A386883 Module[{f = 0, a = 0}, Array[If[f >= 1/#, f -= 1/#; a--, f += 1/#; a++] &, 100]] (* _Paolo Xausa_, Aug 25 2025 *)
%o A386883 (PARI) { print1(0); f = 0; a = 0; for (n = 1, 65, if (f >= 1/n, f -= 1/n; a--, f += 1/n; a++); print1 (", "a);); }
%Y A386883 Cf. A002162, A231692, A231693.
%K A386883 sign,changed
%O A386883 0,7
%A A386883 _Rémy Sigrist_, Aug 06 2025