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 A358269 #16 Nov 27 2022 12:13:22 %S A358269 3,1004,3,1004,3,1004,30,349,30,5,19,5,30,1004,30,8,11,8,30,5,86,17, %T A358269 67,17,15,9,19,9,15,9,19,484,19,13,30,9,19,9,19,13,374,13,19,13,11, %U A358269 484,86,484,19,13,67,16,19,16,19,484,374,484,19,484,374,24,19,13 %N 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. %C A358269 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. %C A358269 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. %C A358269 It is unknown whether all initial conditions "n" guarantee a final prime. All terms up to n = 1000 have a final prime. %C A358269 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. %H A358269 Samuel Harkness, <a href="/A358269/b358269.txt">Table of n, a(n) for n = 0..1111</a> %e A358269 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. %t A358269 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] %Y A358269 Cf. A074171, A358166 %Y A358269 Examples of sequences of the sum of consecutive positive integers, where the sum of at least three is guaranteed to be composite: A055999, A212427. %K A358269 nonn %O A358269 0,1 %A A358269 _Samuel Harkness_, Nov 06 2022