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.

A204142 a(1)=1 and for n>1, a(n) equals the smallest prime greater than a(n-1) of the form a(i)*a(j)+2 for some i, j < n.

Original entry on oeis.org

1, 3, 5, 7, 11, 13, 17, 19, 23, 37, 41, 43, 53, 59, 61, 67, 71, 73, 79, 97, 113, 131, 163, 179, 181, 211, 223, 239, 241, 293, 307, 337, 367, 373, 397, 409, 439, 487, 491, 499, 631, 673, 691, 719, 733, 739, 769, 853, 881, 883, 907, 919, 991
Offset: 1

Views

Author

Max Alekseyev, Jan 16 2012

Keywords

Comments

Is this sequence finite?
For n>1, a(n)-2 is prime or semiprime.
If a(n) is the lesser of a twin prime pair, then a(n+1) = a(n)+2 (= a(1)*a(n)+2). - M. F. Hasler, Feb 11 2012
There are exactly 3478486 terms < 10^18 with a(3478486) = 999999462621744733. - Terentyev Oleg, Mar 09 2012

Examples

			a(2) = a(1)^2+2, a(3) = a(1)*a(2)+2, a(4) = a(1)*a(3)+2, a(5) = a(2)^2+2, a(6)=a(1)*a(5)+2, a(7) = a(1)*a(5)+2, a(8) = a(2)*a(3)+2, ...
a(16027) = 14228123711 is the lesser of a twin prime pair, it is followed by the greater twin prime, a(16028) = 14228123713.
		

Programs

  • Mathematica
    a = {1}; s = {}; While[s = Union[s, Select[a*a[[-1]] + 2, PrimeQ]]; s != {} && Length[a] < 100, AppendTo[a, s[[1]]]; s = Rest[s]]; a (* T. D. Noe, Mar 12 2012 *)
  • PARI
    a=Set(p=1); for(n=1,999, until(bigomega(p-2)<3 & !setminus(Set(factor(p-2)[,1]~),a), p=nextprime(p+2)); a=setunion(a,Set(p))); vecsort(eval(a)) \\ M. F. Hasler, Feb 10 2012
    
  • PARI
    {a=[r=1]; for(n=1, 9999, while(a[r]^2+2<=a[n], r++); m=0; s=r; for(i=r, n, while(s>1&&a[s-1]*a[i]+2>a[n], s--);  for( j=s, i, m & a[j]*a[i]+2>m & break; isprime(a[j]*a[i]+2) & m=a[j]*a[i]+2 ));  a=concat(a, m))} \\ M. F. Hasler, Feb 10 2012