login
The nonprime integers of the sequence appear in blocks. The successive sizes of these blocks are given by the sequence itself.
0

%I #15 May 12 2022 17:49:15

%S 1,2,3,4,6,5,7,8,9,10,11,12,14,15,16,13,17,18,20,21,22,24,25,19,23,26,

%T 27,28,30,32,29,31,33,34,35,36,38,39,40,37,41,42,44,45,46,48,49,50,51,

%U 43,47,52,54,55,56,57,58,60,62,63,53,59,61,64,65,66,68,69,70,72,74,75,76,67,71,73,77,78,80,81,82,84,85,86,87,88,90,79,83,89,91,92,93

%N The nonprime integers of the sequence appear in blocks. The successive sizes of these blocks are given by the sequence itself.

%C The sequence is started with a(1)=1 and always extended with the smallest integer not yet used that doesn't lead to a contradiction.

%C The sequence is a permutation of the natural numbers.

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%e The blocks of nonprime integers are indicated here by parentheses; the successive block-sizes are 1, 2, 3, 4, 6,... which reproduces the sequence itself: P = (1),2,3,(4,6),5,7,(8,9,10),11,(12,14,15,16),13,17,(18,20,21,22,24,25),19,23.

%t a[1]=1;a[n_]:=a[n]=Block[{k=1},While[MemberQ[s=Array[a,n-1],k]||(g=Length/@Select[SplitBy[Join[s,{k}],!PrimeQ@#&],!PrimeQ@First@#&];g!=s[[;;Length@g]]),If[!PrimeQ@k&&FreeQ[s,k],Break[],k++]];k];Array[a,93] (* _Giorgos Kalogeropoulos_, May 12 2022 *)

%K nonn,base

%O 1,2

%A _Eric Angelini_, Aug 02 2016