%I #13 Oct 09 2019 17:48:00
%S 1,1,4,8,8,14,21,21,30,40,51,63,76,90,105,121,138,156,175,195,216,238,
%T 261,285,310,336,363,391,420,450,481,513,546,580,615,651,688,726,765,
%U 805,846,888,931,975,1020,1066,1113,1161,1210,1260,1311,1363,1416,1470
%N a(1) = 1; if a(n-1) + n is composite then a(n) = a(n-1) + n, else a(n) = a(n-1).
%H Michael De Vlieger, <a href="/A083744/b083744.txt">Table of n, a(n) for n = 1..10000</a>
%p a := proc(n) option remember: if n=1 then RETURN(1) fi: if isprime(a(n-1)+n) then RETURN(a(n-1)) else RETURN(a(n-1)+n) fi: end: for n from 1 to 100 do printf(`%d,`,a(n)) od: # _James A. Sellers_, May 19 2003
%t a083744[n_] := Block[{i, t = Table[1, {n}]},
%t For[i = 2, i < n,
%t If[CompositeQ[t[[i - 1]] + i], t[[i]] = t[[i - 1]] + i,
%t t[[i]] = t[[i - 1]]], i++]; t]; a083744[54] (* _Michael De Vlieger_, Dec 24 2014 *)
%t nxt[{n_,a_}]:={n+1,If[CompositeQ[a+n+1],a+n+1,a]}; NestList[nxt,{1,1},60][[All,2]] (* _Harvey P. Dale_, Oct 09 2019 *)
%Y Cf. A083743.
%K easy,nonn
%O 1,3
%A _Amarnath Murthy_, May 05 2003
%E More terms from _James A. Sellers_, May 19 2003