login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
1

%I #7 Jul 25 2015 01:12:47

%S 1,3,10,39,196,1175,8226,65807,592262,5922619,65148810,781785719,

%T 10163214348,142285000871,2134275013064,34148400209023,

%U 580522803553392,10449410463961055,198538798815260046,3970775976305200919

%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. A093464.

%K nonn

%O 1,2

%A _Amarnath Murthy_, Apr 05 2004

%E More terms from _Robert G. Wilson v_, Apr 08 2004