%I #67 May 04 2023 02:20:52
%S 0,1,5,11,59,59,419,839,2519,2519,27719,27719,360359,360359,360359,
%T 720719,12252239,12252239,232792559,232792559,232792559,232792559,
%U 5354228879,5354228879,26771144399,26771144399,80313433199,80313433199
%N Smallest nonnegative number m such that m == i (mod i+1) for all 1 <= i <= n.
%C Also, smallest k such that, for 0 <= i < n, i+1 divides k-i.
%C Suggested by Chinese Remainder Theorem. This sequence can generate others: smallest b(n) such that b(n) == i (mod (i+2)), 1 <= i <= n, gives b(1)=1 and b(n) = a(n+1)-1 for n > 1; smallest c(n) such that c(n) == i (mod (i+3)), 1 <= i <= n, gives c(1)=1, c(2)=17 and c(n) = a(n+2) - 2 for n > 2; smallest d(n) such that c(n) == i (mod (i+4)), 1 <= i <= n, gives d(1)=1, d(2)=26, d(3)=206 and d(n) = a(n+3) - 3 for n > 3, etc.
%C A208768(n) occurs A057820(n) times. - _Reinhard Zumkeller_, Mar 01 2012
%C From _Kival Ngaokrajang_, Oct 10 2013: (Start)
%C A070198(n-1) is m such that max(Sum_{i=1..n} m (mod i)) = A000217(n-1).
%C Example for n = 3:
%C m\i = 1 2 3 sum
%C 1 0 1 1 2
%C 2 0 0 2 2
%C 3 0 1 0 1
%C 4 0 0 1 1
%C 5 0 1 2 3 <--max remainder sum = 3 = A000217(2)
%C 6 0 0 0 0 first occurs at m = 5 = A070198(2)
%C (End)
%H Reinhard Zumkeller, <a href="/A070198/b070198.txt">Table of n, a(n) for n = 0..1000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ChineseRemainder Theorem.html">Chinese Remainder Theorem</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Chinese_remainder_theorem">Chinese remainder theorem</a>
%H <a href="/index/Lc#lcm">Index entries for sequences related to lcm's</a>
%F a(n) = lcm(1, 2, 3, ..., n+1) - 1 = A003418(n+1) - 1.
%e a(3) = 11 because 11 == 1 (mod 2), 11 == 2 (mod 3) and 11 == 3 (mod 4).
%p seq(ilcm($1..n) - 1, n=1..100); # _Robert Israel_, Nov 03 2014
%t f[n_] := ChineseRemainder[ Range[0, n - 1], Range[n]]; Array[f, 28] (* or *)
%t f[n_] := LCM @@ Range@ n - 1; Array[f, 28] (* _Robert G. Wilson v_, Oct 30 2014 *)
%o (Haskell)
%o a070198 n = a070198_list !! n
%o a070198_list = map (subtract 1) $ scanl lcm 1 [2..]
%o -- _Reinhard Zumkeller_, Mar 01 2012
%o (Magma) [Exponent(SymmetricGroup(n))-1 : n in [1..30]]; /* _Vincenzo Librandi_, Oct 31 2014 - after _Arkadiusz Wesolowski_ in A003418 */
%o (Python)
%o from math import lcm
%o def A070198(n): return lcm(*range(1,n+2))-1 # _Chai Wah Wu_, May 02 2023
%Y Cf. A053664, A072562.
%Y Cf. A057825 (indices of primes). - _R. J. Mathar_, Jan 14 2009
%Y Cf. A116151. - _Zak Seidov_, Mar 11 2014
%K easy,nonn
%O 0,3
%A _Benoit Cloitre_, May 06 2002
%E Edited by _N. J. A. Sloane_, Nov 18 2007, at the suggestion of _Max Alekseyev_