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.

A225581 a(n) is the minimal odd prime q such that prime(n)*q + prime(n) + q is prime.

This page as a plain text file.
%I A225581 #36 Sep 07 2021 19:49:37
%S A225581 3,5,3,3,3,5,3,3,7,5,3,3,3,5,3,7,3,11,3,5,5,5,5,3,5,11,17,3,3,5,47,11,
%T A225581 5,5,3,3,3,5,13,11,3,3,5,5,5,11,11,11,3,3,7,5,3,5,3,5,5,3,5,13,11,7,3,
%U A225581 5,11,5,3,5,5,3,19,3,3,5,29,17,3,23,3,5,7,5,5,71,3,5,5,3,3,47,3,5,3,11,3,5,3,3,11,5,23
%N A225581 a(n) is the minimal odd prime q such that prime(n)*q + prime(n) + q is prime.
%H A225581 John-Å. W. Olsen, <a href="/A225581/b225581.txt">Table of n, a(n) for n = 1..1000</a>
%e A225581 n = 1;  p = 2;  q = 3;
%e A225581 n = 2;  p = 3;  q = 5;
%e A225581 n = 3;  p = 5;  q = 3;
%e A225581 n = 4;  p = 7;  q = 3;
%t A225581 a[n_] := Block[{q = 3, p = Prime@n},While[! PrimeQ[p*q + p + q], q = NextPrime@q]; q]; Array[a, 101] (* _Giovanni Resta_, May 11 2013 *)
%o A225581 (PARI) a(n) = my(q=3, p=prime(n)); while(!isprime(p*q+p+q), q = nextprime(q+1)); q; \\ _Michel Marcus_, Sep 06 2021
%o A225581 (Python)
%o A225581 from sympy import isprime, nextprime, prime
%o A225581 def a(n):
%o A225581     q, p = 3, prime(n)
%o A225581     while not isprime(p*q + p + q): q = nextprime(q)
%o A225581     return q
%o A225581 print([a(n) for n in range(1, 102)]) # _Michael S. Branicky_, Sep 06 2021
%Y A225581 Cf. A000040.
%K A225581 nonn,easy
%O A225581 1,1
%A A225581 _John-Å. W. Olsen_, May 11 2013