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.

A330248 a(1) = 1; for n > 1, a(n) is the least nonnegative number such that a(n) + a(n-1) + n is a prime number.

This page as a plain text file.
%I A330248 #18 Jan 06 2020 21:31:08
%S A330248 1,0,0,1,1,0,0,3,1,0,0,1,3,0,2,1,1,0,0,3,5,2,4,1,3,0,2,1,1,0,0,5,3,0,
%T A330248 2,3,1,2,0,1,1,0,0,3,5,2,4,1,3,0,2,5,1,4,0,3,1,0,0,1,5,0,4,3,3,2,2,1,
%U A330248 1,0,0,1,5,0,4,3,3,2,2,1,1,0,0,5,7,4,6
%N A330248 a(1) = 1; for n > 1, a(n) is the least nonnegative number such that a(n) + a(n-1) + n is a prime number.
%C A330248 The primes that result from this sequence are 3, 3, 5, 7, 7, 7, 11, 13, 11, 11, 13, 17, 17, 17, 19, 19, 19, 19, 23, 29, 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 37, 41, 37, 37, 41, ...
%e A330248 When n=5, a(4)=1; we want a(5)+a(4)+5 to be a prime. 1 is the least nonnegative number that satisfies this condition (1+5+1=7). So, a(5)=1.
%t A330248 Nest[Append[#1, Block[{k = 0}, While[! PrimeQ[#1[[-1]] + k + #2], k++]; k]] & @@ {#, Length@ # + 1} &, {1}, 105] (* _Michael De Vlieger_, Dec 14 2019 *)
%o A330248 (PARI) for (n=1, 87, print1 (v=if (n==1, 1, nextprime(n+v)-n-v)", ")) \\ _Rémy Sigrist_, Dec 06 2019
%Y A330248 Cf. A062042.
%K A330248 nonn
%O A330248 1,8
%A A330248 _Ali Sada_, Dec 06 2019