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.

A378841 a(n) is the least prime p such that p + 9*k*(k+1) is prime for 0 <= k <= n-1 but not for k=n.

This page as a plain text file.
%I A378841 #17 Dec 22 2024 21:32:09
%S A378841 2,11,13,5,19,173,3163,83,21013,878359,3676219,239,43,5201390418463,
%T A378841 86927887467919
%N A378841 a(n) is the least prime p such that p + 9*k*(k+1) is prime for 0 <= k <= n-1 but not for k=n.
%p A378841 f:= proc(p) local k;
%p A378841   for k from 1 while isprime(p+k*(k+1)*9) do od:
%p A378841   k
%p A378841 end proc:
%p A378841 A:= Vector(12): count:= 0:
%p A378841 for i from 1 while count < 12 do
%p A378841   v:= f(ithprime(i));
%p A378841   if A[v] = 0 then count:= count+1; A[v]:= ithprime(i) fi
%p A378841 od:
%p A378841 convert(A,list);
%t A378841 Table[p=1;m=9;Monitor[Parallelize[While[True,If[And[MemberQ[PrimeQ[Table[p+m*k*(k+1),{k,0,n-1}]],False]==False,PrimeQ[p+m*n*(n+1)]==False],Break[]];p++];p],p],{n,1,10}]
%o A378841 (PARI) isok(p, n) = for (k=0, n-1, if (! isprime(p + 9*k*(k+1)), return(0))); return (!isprime(p + 9*n*(n+1)));
%o A378841 a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p;
%o A378841 (Perl) use ntheory qw(:all); sub a { my $n = $_[0]; my $lo = 2; my $hi = 2*$lo; while (1) { my @terms = grep { !is_prime($_ + 9*$n*($n+1)) } sieve_prime_cluster($lo, $hi, map { 9*$_*($_+1) } 1 .. $n-1); return $terms[0] if @terms; $lo = $hi+1; $hi = 2*$lo; } }; $| = 1; for my $n (1..100) { print a($n), ", " }; #
%Y A378841 Cf. A164926, A370387, A371024, A376675, A378839.
%K A378841 nonn,more
%O A378841 1,1
%A A378841 _J.W.L. (Jan) Eerland_, Dec 09 2024
%E A378841 a(14) from _Daniel Suteu_, Dec 17 2024
%E A378841 a(15) from _Daniel Suteu_, Dec 22 2024