login
A008336
a(n+1) = a(n)/n if n|a(n) else a(n)*n, a(1) = 1.
29
1, 1, 2, 6, 24, 120, 20, 140, 1120, 10080, 1008, 11088, 924, 12012, 858, 12870, 205920, 3500640, 194480, 3695120, 184756, 3879876, 176358, 4056234, 97349616, 2433740400, 93605400, 2527345800, 90262350, 2617608150, 87253605, 2704861755, 86555576160, 2856334013280
OFFSET
1,3
COMMENTS
The graph of log_10(a(n)+1) seems to suggest that log(a(n)) is asymptotic to C*n where C is approximately 0.8. - Daniel Forgues, Sep 18 2011
Comments from N. J. A. Sloane, Apr 14 2024: (Start)
See A370968 for the terms in increasing order with duplicates omitted.
See A337486 and A195504 for the n such that a(n+1) = a(n)/n.
Guy and Nowakowski give bounds on a(n).
Theorem: 1 is the only repeated term.
Proof: Write a(n) for A008336(n).
Suppose, seeking a contradiction, that for 1 < r < s we have a(r) = a(s).
This means that a(r)*r^e_0*(r+1)^e_1*(r+2)^e_2*...(s-1)^e_t = a(s) = a(r),
where the exponents e_* are +1 or -1. The product (P1, say) of the terms with exponent +1 must equal the product (P2, say) of the terms with exponent -1. Since r>1, we need s >= r+2.
The product P1*P2 = P1^2 of all these terms is (s-1)!/(r-1)!.
But this contradicts Erdos's theorem (Erdos 1939) that the product of two or more consecutive integers is never a square. QED.
(End)
REFERENCES
P. Erdos, On the product of consecutive integers, J. London Math. Soc., 14 (1939), 194-198.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..2732 (terms 1..1000 from T. D. Noe)
R. K. Guy and R. Nowakowski, Unsolved Problems, Amer. Math. Monthly, vol. 102 (1995), 921-926; circa page 924.
R. K. Guy and R. Nowakowski, Annotated extract from previous link
N. J. A. Sloane, My favorite integer sequences, in Sequences and their Applications (Proceedings of SETA '98).
MAPLE
A008336 := proc(n) option remember; if n = 1 then 1 elif A008336(n-1) mod (n-1) = 0 then A008336(n-1)/(n-1) else A008336(n-1)*(n-1); fi; end;
MATHEMATICA
a[n_] := a[n] = If[ Divisible[ a[n-1], n-1], a[n-1]/(n-1), a[n-1]*(n-1)]; a[1] = 1; Table[a[n], {n, 1, 28}] (* Jean-François Alcover, Dec 02 2011 *)
nxt[{n_, a_}]:={n+1, If[Divisible[a, n], a/n, n*a]}; Transpose[ NestList[ nxt, {1, 1}, 30]][[2]] (* Harvey P. Dale, May 09 2016 *)
PROG
(Haskell)
a008336 n = a008336_list !! (n-1)
a008336_list = 1 : zipWith (/*) a008336_list [1..] where
x /* y = if x `mod` y == 0 then x `div` y else x*y
-- Reinhard Zumkeller, Feb 22 2012, Oct 25 2010
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A008336(n):
if n == 1: return 1
a, b = divmod(c:=A008336(n-1), n-1)
return c*(n-1) if b else a # Chai Wah Wu, Apr 11 2024
CROSSREFS
Cf. A005132 (the original Recaman sequence).
A065422 and A260850 are variants of the present sequence.
Cf. also A195504 = Product of numbers up to n-1 used as divisors in A008336(n), n >= 2; a(1) = 1.
Cf. also A337486, A370968.
Sequence in context: A360300 A065422 A260850 * A360298 A033643 A050211
KEYWORD
nonn,easy,nice,look
STATUS
approved