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.
%I A330823 #19 Jan 05 2020 11:38:48 %S A330823 1,-1,-4,6,1,8,1,8,15,22,11,19,6,14,22,31,14,23,4,14,24,34,11,22,33, %T A330823 44,55,67,38,50,19,31,44,57,70,83,46,60,74,88,47,62,19,34,50,66,19,35, %U A330823 51,68,85,102,49,67,85,103,121,139,80,99,38,57,77,97,117,137,70 %N A330823 a(1) = 1; for n > 1, a(n) = a(n-1) - n if n is prime, otherwise a(n) = a(n-1) + floor(n/(log(n)-1)). %C A330823 The Prime Number Theorem shows that the probability of a random number not greater than x being prime is approximately 1/log(x), therefore the probability of a number being composite in the same range is approximately (log(x)-1)/log(x). As this sequence subtracts n from the previous term if n is prime, or adds n with a weighting of 1/(log(n)-1) if n is composite, its expected value as n goes to infinity is approximately n*(1/(log(n)-1))*((log(n)-1)/log(n)) - n*(1/log(n)) = 0. We therefore expect that a(n)/n approaches 0 as n goes to infinity. %C A330823 In the first 2 million terms the sequence changes sign 1900 times, has a maximum positive value of 160213275 at a(1772200), and a maximum negative value of -29535301 at a(1513751). The majority of terms are positive. See the image link below. %H A330823 Scott R. Shannon, <a href="/A330823/a330823.png">Graph showing a(n) for n = 1 to 2000000</a>. The blue line is the x axis. %H A330823 Wikipedia, <a href="https://en.wikipedia.org/wiki/Prime_number_theorem">Prime Number Theorem</a> and <a href="https://en.wikipedia.org/wiki/Prime-counting_function">Prime Counting Function</a>. %t A330823 a[1] = 1; a[n_] := a[n] = a[n - 1] + If[PrimeQ[n], -n, Floor[n/(Log[n] - 1)]]; Array[a, 67] (* _Amiram Eldar_, Jan 05 2020 *) %Y A330823 Cf. A000040, A057835, A060769, A060770, A050499, A085581. %K A330823 sign,look %O A330823 1,3 %A A330823 _Scott R. Shannon_, Jan 02 2020