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.

A330547 a(1)=2; thereafter a(n) = a(n-1) + (-1)^(n+1)*(prime(n)-prime(n-1)) (where prime(k) denotes the k-th prime).

This page as a plain text file.
%I A330547 #71 Jan 22 2024 06:08:25
%S A330547 2,1,3,1,5,3,7,5,9,3,5,-1,3,1,5,-1,5,3,9,5,7,1,5,-1,7,3,5,1,3,-1,13,9,
%T A330547 15,13,23,21,27,21,25,19,25,23,33,31,35,33,45,33,37,35,39,33,35,25,31,
%U A330547 25,31,29,35,31,33,23,37,33,35,31,45,39,49,47,51,45,53,47,53,49,55,47,51,43,53,51,61,59,65,61
%N A330547 a(1)=2; thereafter a(n) = a(n-1) + (-1)^(n+1)*(prime(n)-prime(n-1)) (where prime(k) denotes the k-th prime).
%C A330547 There are several equivalent definitions:
%C A330547 a(n) = (-1)^(n+1)*(prime(n) + 2*(Sum_{i=1..n-1} (-1)^i*prime(n-i)));
%C A330547 a(n) = (-1)^n*(prime(n) - 2*A008347(n)) for n >= 1;
%C A330547 a(n) = A330545(n) if n is odd, a(n) = A330545(n)-1 if n is even;
%C A330547 generating function = P(-x)*(x+1)/(x-1), where P(x) = 2*x + 3*x^2 + 5*x^3 + ... = Sum_{k>=1} prime(k)*x^k is the g.f. for the primes.
%C A330547 Note that the recurrence closely resembles that of A330545, but is slightly simpler. _Hans Havermann_'s graphs of A330545, linked here, also essentially apply to the present sequence.
%C A330547 This sequence ties together A330339, A330545, A008347, and the primes.
%C A330547 Just as A330545 describes the boustrophedon path that generates the "Boustrophedon Primes" in A330339, the present sequence can also be regarded as defining a boustrophedon path with a slightly different rule, as follows. Write the numbers 0, 1, 2, 3, ... in a triangle on a square grid in the boustrophedon manner, ending a row when a prime is reached, and starting the next row in the opposite direction, but displaced by one square in that direction:
%C A330547 -1.0.1.2.3..4..5..6..7..8..9.
%C A330547 -----------------------------
%C A330547 ...0 1 2
%C A330547 .....3
%C A330547 .......4 5
%C A330547 .....7 6
%C A330547 .......8 9 10 11
%C A330547 ........13 12
%C A330547 ...........14 15 16 17
%C A330547 ..............19 18
%C A330547 .................20 21 22 23
%C A330547 ...
%C A330547 Since all primes>2 are odd, here the odd primes only appear in odd-number4d columns (and in particular there are no primes in column 0).
%C A330547 In fact the primes (other than 2) occur only in odd-numbered columns: primes congruent to 3 mod 4 occur in columns congruent to 1 mod 4, and primes congruent to 1 mod 4 occur in columns congruent to 3 mod 4. See the "Notes" link for proof. - _N. J. A. Sloane_, Jan 04 2020
%C A330547 It would be nice to know something about the asymptotic growth of this sequence. The usual estimates for the primes do not seem to produce anything useful.
%C A330547 For large n, the graphs of A330545 and A330547 are essentially identical.
%C A330547 Based on the first 10^12 terms, it appears that lim sup |a(n)| is about n^(2/3). This estimate is based on the plots given in A330545 by Sloane, Trump (the first plot), Havermann (the first plot), and Stevenson (all three plots).- _N. J. A. Sloane_, Jan 21 2020
%C A330547 Conjecture. Let k be an integer and X_k be the set of all n such that (-1)^n*a(n)=2k-1. If a, b are integers and a<>0, then X_k contains infinitely many terms of the arithmetic progression {a*n+b: n integer}. - _M. Farrokhi D. G._, Nov 12 2023
%H A330547 N. J. A. Sloane, <a href="/A330547/b330547.txt">Table of n, a(n) for n = 1..30000</a>
%H A330547 Hans Havermann, <a href="/A330545/a330545.png">Plot of 4*10^8 terms of A330545</a>, sampled every 1000 terms, points joined
%H A330547 Hans Havermann, <a href="/A330545/a330545_1.png">More detailed view of terms of A330545 from 290 million to 310 million</a>, sampled every 10 terms, points joined.
%H A330547 N. J. A. Sloane, <a href="/A330339/a330339.txt">Notes on the sequence of Bostrophedon primes (A330339) and the "ski-run" A330545.</a>
%H A330547 Frank Stevenson, <a href="/A330547/a330547.png">Plot of first 10^10 terms of A330547, sampled every 10^5 steps.</a> Havermann's plot of 4*10^8 terms appears at the very start of this plot.
%H A330547 Frank Stevenson, <a href="/A330547/a330547_1.png">Plot of first 10^11 terms of A330547, sampled every 10^6 steps.</a> The preceding plot of 10^10 terms can be seen to the left of the blue line.
%H A330547 Frank Stevenson, <a href="/A330547/a330547_2.png">Plot of first 10^12 terms of A330547, sampled every 10^7 steps.</a> The preceding plot of 10^11 terms can be seen to the left of the blue line.
%p A330547 f:=n-> (-1)^(n+1)*(ithprime(n)+2*add((-1)^i*ithprime(n-i),i=1..n-1));
%p A330547 [seq(f(n),n=1..400)];
%t A330547 a[1]=2; a[n_]:= a[a]=a[n-1]+ (-1)^(n+1)*(Prime[n]-Prime[n-1]);Table[a[n],{n,86}] (* _James C. McMahon_, Dec 18 2023 *)
%Y A330547 Cf. A000040, A008347, A330339, A330545.
%K A330547 sign
%O A330547 1,1
%A A330547 _N. J. A. Sloane_, Dec 19 2019