cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A008336 a(n+1) = a(n)/n if n|a(n) else a(n)*n, a(1) = 1.

This page as a plain text file.
%I A008336 #81 Apr 15 2024 13:10:29
%S A008336 1,1,2,6,24,120,20,140,1120,10080,1008,11088,924,12012,858,12870,
%T A008336 205920,3500640,194480,3695120,184756,3879876,176358,4056234,97349616,
%U A008336 2433740400,93605400,2527345800,90262350,2617608150,87253605,2704861755,86555576160,2856334013280
%N A008336 a(n+1) = a(n)/n if n|a(n) else a(n)*n, a(1) = 1.
%C A008336 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
%C A008336 Comments from _N. J. A. Sloane_, Apr 14 2024: (Start)
%C A008336 See A370968 for the terms in increasing order with duplicates omitted.
%C A008336 See A337486 and A195504 for the n such that a(n+1) = a(n)/n.
%C A008336 Guy and Nowakowski give bounds on a(n).
%C A008336 Theorem: 1 is the only repeated term.
%C A008336 Proof: Write a(n) for A008336(n).
%C A008336 Suppose, seeking a contradiction, that for 1 < r < s we have a(r) = a(s).
%C A008336 This means that a(r)*r^e_0*(r+1)^e_1*(r+2)^e_2*...(s-1)^e_t = a(s) = a(r),
%C A008336 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.
%C A008336 The product P1*P2 = P1^2 of all these terms is (s-1)!/(r-1)!.
%C A008336 But this contradicts Erdos's theorem (Erdos 1939) that the product of two or more consecutive integers is never a square.  QED.
%C A008336 (End)
%D A008336 P. Erdos, On the product of consecutive integers, J. London Math. Soc., 14 (1939), 194-198.
%H A008336 Indranil Ghosh, <a href="/A008336/b008336.txt">Table of n, a(n) for n = 1..2732</a> (terms 1..1000 from T. D. Noe)
%H A008336 R. K. Guy and R. Nowakowski, <a href="http://www.jstor.org/stable/2975272">Unsolved Problems</a>, Amer. Math. Monthly, vol. 102 (1995), 921-926; circa page 924.
%H A008336 R. K. Guy and R. Nowakowski, <a href="/A008336/a008336.jpg">Annotated extract from previous link</a>
%H A008336 Nick Hobson, <a href="/A008336/a008336.py.txt">Python program for this sequence</a>
%H A008336 N. J. A. Sloane, <a href="http://neilsloane.com/doc/sg.txt">My favorite integer sequences</a>, in Sequences and their Applications (Proceedings of SETA '98).
%H A008336 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%p A008336 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;
%t A008336 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 *)
%t A008336 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 *)
%o A008336 (Haskell)
%o A008336 a008336 n = a008336_list !! (n-1)
%o A008336 a008336_list = 1 : zipWith (/*) a008336_list [1..] where
%o A008336     x /* y = if x `mod` y == 0 then x `div` y else x*y
%o A008336 -- _Reinhard Zumkeller_, Feb 22 2012, Oct 25 2010
%o A008336 (Python)
%o A008336 from functools import lru_cache
%o A008336 @lru_cache(maxsize=None)
%o A008336 def A008336(n):
%o A008336     if n == 1: return 1
%o A008336     a, b = divmod(c:=A008336(n-1),n-1)
%o A008336     return c*(n-1) if b else a # _Chai Wah Wu_, Apr 11 2024
%Y A008336 Cf. A005132 (the original Recaman sequence).
%Y A008336 A065422 and A260850 are variants of the present sequence.
%Y A008336 Cf. also A195504 = Product of numbers up to n-1 used as divisors in A008336(n), n >= 2; a(1) = 1.
%Y A008336 Cf. also A337486, A370968.
%K A008336 nonn,easy,nice,look
%O A008336 1,3
%A A008336 _Bernardo Recamán_