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.

A070942 Values of n such that the first n terms of A055265 constitute a permutation of {1,2,3,...,n}.

This page as a plain text file.
%I A070942 #18 Sep 13 2014 14:27:58
%S A070942 1,2,3,4,7,8,9,10,17,18,19,22,23,24,43,55,56,57,73,99,136,137,142,143,
%T A070942 202,217,218,233,234,264,281,282,287,288,289,302,303,304,387,409,414,
%U A070942 415,491,509,520,521,528,529,532,533,553,554,555,588,652,653,654,665
%N A070942 Values of n such that the first n terms of A055265 constitute a permutation of {1,2,3,...,n}.
%H A070942 Zak Seidov and Robert Israel, <a href="/A070942/b070942.txt">Table of n, a(n) for n = 1..1500</a> (first 286 terms from Zak Seidov)
%p A070942 S:= {1}: L:= {}:
%p A070942 a[1]:= 1: b[1]:= 1:
%p A070942 count:= 1:
%p A070942 for n from 2 to 10000 do
%p A070942   for k in L do
%p A070942     if isprime(k+b[n-1]) then
%p A070942       b[n]:= k;
%p A070942       S:= S union {k};
%p A070942       L:= L minus {k};
%p A070942       if L = {} then
%p A070942         count:= count+1;
%p A070942         a[count]:= n;
%p A070942       fi;
%p A070942       break;
%p A070942     fi
%p A070942   od:
%p A070942   if not assigned(b[n]) then
%p A070942     for k from max(S) + 1 do
%p A070942       if isprime(k+b[n-1]) then
%p A070942         b[n]:= k;
%p A070942         if k = max(S) + 1 and L = {} then
%p A070942            count:= count+1;
%p A070942            a[count]:= n;
%p A070942         fi;
%p A070942         S:= S union {k};
%p A070942         L:= {$1..k} minus S;
%p A070942         break
%p A070942       fi
%p A070942     od
%p A070942   fi;
%p A070942 od:
%p A070942 seq(a[i], i=1..count); # _Robert Israel_, Sep 10 2014
%Y A070942 Cf. A055265.
%K A070942 nonn
%O A070942 1,2
%A A070942 _John W. Layman_, Apr 15 2003