login
a(n)=1 if n is a prime number, otherwise a(n)=n.
5

%I #39 Nov 23 2022 11:41:47

%S 1,1,1,4,1,6,1,8,9,10,1,12,1,14,15,16,1,18,1,20,21,22,1,24,25,26,27,

%T 28,1,30,1,32,33,34,35,36,1,38,39,40,1,42,1,44,45,46,1,48,49,50,51,52,

%U 1,54,55,56,57,58,1,60

%N a(n)=1 if n is a prime number, otherwise a(n)=n.

%C Denominator of (1 + Gamma(n))/n.

%D Paulo Ribenboim, The little book of big primes, Springer 1991, p. 106.

%H G. C. Greubel, <a href="/A005451/b005451.txt">Table of n, a(n) for n = 1..5000</a>

%H Achilleas Sinefakopoulos, <a href="https://web.archive.org/web/20010608193230/http://users.forthnet.gr/ath/asin/proandsol.htm">Problem 10578</a> (Submitted solution.)

%H H. S. Wilf, <a href="http://www.jstor.org/stable/2974795">Problem 10578</a>, Amer. Math. Monthly, 104 (1997), 270.

%F Define b(n) = ( (n-1)*(n^2-3*n+1)*b(n-1) - (n-2)^3*b(n-2) )/(n*(n-3)); b(2) = b(3) = 1; a(n) = denominator(b(n)).

%F a(n) = A088140(n), n >= 3. - _R. J. Mathar_, Oct 28 2008

%F a(n) = gcd(n, (n!*n!!)/n^2). - _Lechoslaw Ratajczak_, Mar 09 2019

%p seq(denom((1 + (n-1)!)/n), n=1..80); # _G. C. Greubel_, Nov 22 2022

%t Table[If[PrimeQ[n], 1, n], {n, 70}] (* _Vincenzo Librandi_, Feb 22 2013 *)

%t a[n_] := ((n-1)! + 1)/n - Floor[(n-1)!/n] // Denominator; Table[a[n] , {n, 70}] (* _Jean-François Alcover_, Jul 17 2013, after Minac's formula *)

%t Table[Denominator[(1 + Gamma[n])/n], {n,2,70}] (* _G. C. Greubel_, Nov 22 2022 *)

%o (Magma) [IsPrime(n) select 1 else n: n in [1..70]]; // _Vincenzo Librandi_, Feb 22 2013

%o (Magma) [Denominator((1 + Factorial(n-1))/n): n in [1..70]]; // _G. C. Greubel_, Nov 22 2022

%o (Sage)

%o def A005451(n):

%o if n == 4: return n

%o f = factorial(n-1)

%o return 1/((f + 1)/n - f//n)

%o [A005451(n) for n in (1..71)] # _Peter Luschny_, Oct 16 2013

%o (SageMath) [denominator((1+gamma(n))/n) for n in range(1,71)] # _G. C. Greubel_, Nov 22 2022

%Y Cf. A005450 (numerators).

%Y Cf. A088140, A089026, A135684, A181569.

%K nonn,frac

%O 1,4

%A _N. J. A. Sloane_

%E Name edited and a(1)=1 prepended by _G. C. Greubel_, Nov 22 2022. Name further edited by _N. J. A. Sloane_, Nov 22 2022