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.

A377371 a(n) = k*(a(n-1)+n), k=-1 for prime n, otherwise k=1 (a(1)=1).

This page as a plain text file.
%I A377371 #14 Dec 30 2024 17:08:47
%S A377371 1,-3,0,4,-9,-3,-4,4,13,23,-34,-22,9,23,38,54,-71,-53,34,54,75,97,
%T A377371 -120,-96,-71,-45,-18,10,-39,-9,-22,10,43,77,112,148,-185,-147,-108,
%U A377371 -68,27,69,-112,-68,-23,23,-70,-22,27,77,128,180,-233,-179,-124,-68,-11
%N A377371 a(n) = k*(a(n-1)+n), k=-1 for prime n, otherwise k=1 (a(1)=1).
%C A377371 From the infinitude of the primes, k<0 will always be seen, and the +/- halves of the graph are essentially mirror images. The number of sign changes through n should be on the order of primepi(n).
%H A377371 Michael De Vlieger, <a href="/A377371/b377371.txt">Table of n, a(n) for n = 1..10000</a>
%F A377371 a(n) = a(n-1) + n for composite n, else -(a(n-1) + n).
%e A377371 a(1)=1. For n=2 (prime), a(2) = -(1+2) = -3. For n=3 (prime), a(3) = -(-3+3) = 0.
%t A377371 j = 1; {j}~Join~Reap[Do[k = (1 - 2 Boole[PrimeQ[n]])*(j + n); j = Sow[k], {n, 2, 57}] ][[-1, 1]] (* _Michael De Vlieger_, Dec 28 2024 *)
%K A377371 sign,easy
%O A377371 1,2
%A A377371 _Bill McEachen_, Dec 27 2024