login
a(1) = a(2) = 1. a(n) = a(n-1) + (largest nonprime {1 or composite} among the first n-2 terms of the sequence).
2

%I #10 Aug 09 2015 14:48:26

%S 1,1,2,3,4,5,9,13,22,31,53,75,97,172,247,419,666,913,1579,2492,3405,

%T 5897,9302,12707,22009,34716,56725,91441,148166,239607,387773,627380,

%U 1015153,1642533,2657686,4300219,6957905,11258124,18216029,29474153

%N a(1) = a(2) = 1. a(n) = a(n-1) + (largest nonprime {1 or composite} among the first n-2 terms of the sequence).

%e Among the first 8 terms of the sequence, 9 is the largest nonprime. So a(10) = a(9) + 9 = 22 + 9 = 31.

%p isA018252 := proc(n) if n = 1 or not isprime(n) then true ; else false ; fi ; end: A120760 := proc(nmin) local a,lnpr,k; a := [1,1,2] ; while nops(a) < nmin do lnpr :=0 ; for k in [op(1..nops(a)-1,a)] do if isA018252(k) then lnpr := max(lnpr,k) ; fi ; od: a := [op(a),a[ -1]+lnpr] ; od: RETURN(a) ; end: A120760(80) ; # _R. J. Mathar_, Sep 18 2007

%Y Cf. A120761.

%K nonn

%O 1,3

%A _Leroy Quet_, Jul 03 2006

%E More terms from _R. J. Mathar_, Sep 18 2007