%I #6 Jul 25 2015 00:55:46
%S 1,1,2,9,44,265,1854,14833,133498,1334981,14684790,176217481,
%T 2290827252,32071581529,481073722936,7697179566977,130852052638608,
%U 2355336947494945,44751402002403954,895028040048079081
%N a(1) = 1; for n>1, a(n) = n*a(n-1) - 1 if n is a prime else a(n) = n*a(n-1) + 1.
%t a[1] = 1; a[n_] := a[n] = (p = n*a[n - 1] - 1; If[ PrimeQ[n], p, p + 2]); Table[ a[n], {n, 20}] (* _Robert G. Wilson v_, Apr 08 2004 *)
%Y Cf. A093463.
%Y Cf. A000166.
%K nonn
%O 1,3
%A _Amarnath Murthy_, Apr 05 2004
%E More terms from _Robert G. Wilson v_, Apr 08 2004