%I #22 Feb 04 2024 13:09:39
%S 2,2,3,2,5,2,7,2,2,2,11,2,13,2,2,2,17,2,19,2,2,2,23,2,2,2,2,2,29,2,31,
%T 2,2,2,2,2,37,2,2,2,41,2,43,2,2,2,47,2,2,2,2,2,53,2,2,2,2,2,59,2,61,2,
%U 2,2,2,2,67,2,2,2,71,2,73,2,2,2,2,2,79,2,2,2,83,2,2,2,2,2,89,2,2,2,2,2,2,2
%N a(n) = 2 + (2*n! mod n+1).
%C Prime generating formula based on Wilson's theorem.
%D Wladyslaw Narkiewicz, The development of prime number theory: from Euclid to Hardy and Littlewood, Springer-Verlag, New York, 2000, pp. 46-47.
%H M. Prunescu and L. Sauras-Altuzarra, <a href="https://doi.org/10.1016/j.exco.2024.100136">An arithmetic term for the factorial function</a>, Examples and Counterexamples, Vol. 5 (2024).
%p f:=n->(2*n! mod (n+1))+2; [seq(f(n),n=0..100)];
%t a[n_] := 2 + Mod[2*n!, n + 1]
%t Table[a[n], {n, 0, 100}]
%Y Cf. A000040, A000142.
%K nonn
%O 0,1
%A _Roger L. Bagula_, May 13 2006
%E Edited by _N. J. A. Sloane_, Jun 12 2007