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!)
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)). 1
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, 44, 55, 67, 38, 50, 19, 31, 44, 57, 70, 83, 46, 60, 74, 88, 47, 62, 19, 34, 50, 66, 19, 35, 51, 68, 85, 102, 49, 67, 85, 103, 121, 139, 80, 99, 38, 57, 77, 97, 117, 137, 70 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
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.
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.
LINKS
Scott R. Shannon, Graph showing a(n) for n = 1 to 2000000. The blue line is the x axis.
MATHEMATICA
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 *)
CROSSREFS
Sequence in context: A263180 A239809 A203999 * A199371 A156789 A195423
KEYWORD
sign,look
AUTHOR
Scott R. Shannon, Jan 02 2020
STATUS
approved

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 08:08 EDT 2024. Contains 371265 sequences. (Running on oeis4.)