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.

A073662 Rearrangement of even numbers such that a(k)*a(k+1) + 1 is a prime for all k.

This page as a plain text file.
%I A073662 #14 Feb 28 2019 03:18:29
%S A073662 2,6,10,4,18,22,16,12,8,14,20,26,36,28,24,32,38,42,34,30,40,52,46,66,
%T A073662 48,44,54,64,70,60,50,56,80,68,62,84,74,90,72,58,76,88,94,78,82,96,
%U A073662 100,106,120,86,98,104,122,108,112,118,102,116,132,124,142,114,110,128,92
%N A073662 Rearrangement of even numbers such that a(k)*a(k+1) + 1 is a prime for all k.
%C A073662 a(1)=2; a(n) is the smallest number not already in the sequence such that a(n)*a(n-1) + 1 is a prime. Some numbers retain their places (that is an even number 2n retains its n-th position), such numbers are in A076023.
%H A073662 Robert Israel, <a href="/A073662/b073662.txt">Table of n, a(n) for n = 1..10000</a>
%p A073662 Avail:= 2*[$2..110]:
%p A073662 A[1]:= 2:
%p A073662 for n from 2 do
%p A073662     found:= false:
%p A073662     for i in Avail do
%p A073662       if isprime(i*A[n-1]+1) then
%p A073662         A[n]:= i;
%p A073662         Avail:= subs(i=NULL,Avail);
%p A073662         found:= true;
%p A073662         break
%p A073662      fi
%p A073662     od;
%p A073662     if not found then break fi
%p A073662 od:
%p A073662 seq(A[i],i=1..n-1); # _Robert Israel_, Jul 16 2018
%t A073662 amax = 200; a[1] = 2; aa = Range[4, amax, 2];
%t A073662 a[n_] := a[n] = For[k = 1, k <= Length[aa], k++, an = aa[[k]]; If[PrimeQ[ a[n - 1] an + 1], aa = Delete[aa, k]; Return[an]]];
%t A073662 DeleteCases[Array[a, Floor[amax/2]], Null] (* _Jean-François Alcover_, Feb 28 2019 *)
%Y A073662 Cf. A073661, A076023.
%K A073662 nonn
%O A073662 1,1
%A A073662 _Amarnath Murthy_, Aug 10 2002
%E A073662 More terms from _Hans Havermann_, Sep 23 2002