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.

A363707 For n >= 2, a(n) = a(n-1) + a(n-2) + A051697(n), a(0)=0, a(1)=1.

This page as a plain text file.
%I A363707 #23 Aug 02 2023 12:01:09
%S A363707 0,1,3,7,13,25,43,75,125,207,343,561,915,1489,2417,3919,6353,10289,
%T A363707 16659,26967,43645,70631,114299,184953,299275,484251,783549,1267829,
%U A363707 2051407,3319265,5370701,8689997,14060729,22750757,36811517,59562311,96373865,155936213,252310115
%N A363707 For n >= 2, a(n) = a(n-1) + a(n-2) + A051697(n), a(0)=0, a(1)=1.
%F A363707 a(0)=0, a(1)=1, a(n) = a(n-1) + a(n-2) + p(n), where p(n) = min{p:p is prime and |p-n| is minimized, and the smaller prime when n is equidistant between primes}.
%e A363707 a(2) = 3 since a(1) + a(0) = 1 and p(2) = 2. Furthermore a(3) = 3 + 1 + p(3) = 7.
%t A363707 p[n_] := (np = NextPrime[n]; pp = Prime[PrimePi[np] - 1];
%t A363707    Which[np > 2 n - pp, pp, np < 2 n - pp, np, True, pp]); (* Using the already existing code from A051697 *)
%t A363707 sequenceLength = 50; (* Specify the desired length of the sequence *)
%t A363707 sequence = {0,1}; (* Initialize the sequence with the first two terms *)
%t A363707 For[n = 2, n < sequenceLength, n++,
%t A363707  nextTerm = sequence[[-2]] + sequence[[-1]] + p[n];
%t A363707  sequence = Append[sequence, nextTerm]]
%t A363707 Print[sequence]
%Y A363707 Cf. A051697.
%K A363707 nonn
%O A363707 0,3
%A A363707 _Yanick Willert_, Jun 16 2023