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!)
A358269 a(n) is the position m of the last prime term in the sequence {b(m)} defined by b(1) = n, if b(m) is prime then b(m+1) = b(m) - m, else b(m+1) = b(m) + m. 1
3, 1004, 3, 1004, 3, 1004, 30, 349, 30, 5, 19, 5, 30, 1004, 30, 8, 11, 8, 30, 5, 86, 17, 67, 17, 15, 9, 19, 9, 15, 9, 19, 484, 19, 13, 30, 9, 19, 9, 19, 13, 374, 13, 19, 13, 11, 484, 86, 484, 19, 13, 67, 16, 19, 16, 19, 484, 374, 484, 19, 484, 374, 24, 19, 13 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
A sequence {b(m)} is guaranteed to have no more primes when the m-th term "k" with value "s" is the sum of at least 3 consecutive positive integers where the sum is "s" and the last consecutive positive integer in the sum is k-1. Any number which is the sum of at least three consecutive positive integers is guaranteed to be composite. By the definition of the sequence, the next term k + 1 = s + k, and this term will be the sum of at least three consecutive positive integers with the last consecutive positive integer being k. This guarantees that this term is also guaranteed to be composite, and by induction, all future terms in {b(m)} will be composite.
In a sequence {b(m)}, if the m-th term k with value s satisfies c = (sqrt(-8*s + 4*k^2 - 4*k + 1) + 1)/2 for a positive integer c with s being nonprime and k > 3 then the value of all terms >= k will be composite.
It is unknown whether all initial conditions "n" guarantee a final prime. All terms up to n = 1000 have a final prime.
Treat negative numbers in the sequence {b(m)} as nonprime. The only n whose {b(m)} contain negative terms b(m) are 1, 3, 6, and 7.
LINKS
EXAMPLE
For n = 9: b(1) = 9. Nonprime, b(2) = 9 + 1 = 10. Nonprime, b(3) = 10 + 2 = 12. Nonprime, b(4) = 12 + 3 = 15. Nonprime, b(5) = 15 + 4 = 19. Prime, b(6) = 19 - 5 = 14. Note 14 = 2 + 3 + 4 + 5 and is nonprime, so b(7) = 2 + 3 + 4 + 5 + 6 and nonprime. All b(m) after this will be nonprime by the same pattern, thus the final prime for b(1) = 9 occurs at b(5), and a(9) = 5.
MATHEMATICA
T = {}; For[f = 0, f <= 63, f++, a = 0; t = f; q = 0; While[a == 0, q++; If[t < 0, t += q, If[PrimeQ[t], t -= q; If[t >= 0, If[q != 2 && q != 1 && ! PrimeQ[t], s = t; k = q + 1; z = (Sqrt[-8 s + 4 k^2 - 4 k + 1] + 1)/2; If[Element[z, Reals] && z > 0 && Mod[z, 1] == 0, AppendTo[T, q]; Break[]]]], t += q]]]]; Print[T]
CROSSREFS
Examples of sequences of the sum of consecutive positive integers, where the sum of at least three is guaranteed to be composite: A055999, A212427.
Sequence in context: A030250 A145231 A318480 * A167069 A024046 A152505
KEYWORD
nonn
AUTHOR
Samuel Harkness, Nov 06 2022
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 July 11 10:17 EDT 2024. Contains 374228 sequences. (Running on oeis4.)