login
Distance from n-th composite number (A002808) to next prime.
1

%I #9 Apr 28 2016 15:08:21

%S 1,1,3,2,1,1,3,2,1,1,3,2,1,5,4,3,2,1,1,5,4,3,2,1,3,2,1,1,3,2,1,5,4,3,

%T 2,1,5,4,3,2,1,1,5,4,3,2,1,3,2,1,1,5,4,3,2,1,3,2,1,5,4,3,2,1,7,6,5,4,

%U 3,2,1,3,2,1,1,3,2,1,1,3,2,1,13,12,11,10,9,8,7,6,5,4,3,2,1,3,2,1,5,4,3,2,1

%N Distance from n-th composite number (A002808) to next prime.

%F Beginning with 2, make sequence of composites; measure distances to next prime

%e a(1)=4, composite; distance to next prime, 5, is 1.

%t Table[NextPrime[n]-n,{n,Select[Range[150],CompositeQ]}] (* _Harvey P. Dale_, Apr 28 2016 *)

%Y Cf. A002808.

%K easy,nonn

%O 1,3

%A _Enoch Haga_, Jan 16 2000

%E Edited by _N. J. A. Sloane_, Sep 09 2011