login
Lexicographically earliest increasing sequence such that n-th term is divisible by all positive integers up to n.
1

%I #18 Aug 28 2019 16:09:33

%S 1,2,6,12,60,120,420,840,2520,5040,27720,55440,360360,720720,1081080,

%T 1441440,12252240,24504480,232792560,465585120,698377680,931170240,

%U 5354228880,10708457760,26771144400,53542288800,80313433200,160626866400,2329089562800,4658179125600,72201776446800

%N Lexicographically earliest increasing sequence such that n-th term is divisible by all positive integers up to n.

%H Rémy Sigrist, <a href="/A309233/b309233.txt">Table of n, a(n) for n = 1..2000</a>

%e The 5th term 60, is divisible by 1,2,3,4, and 5.

%e The 6th term 120, greater than 60, is divisible by 1,2,3,4,5, and 6.

%e The 10th term 5040, greater than 2520, is divisible by 1,2,3,4,5,6,7,8,9, and 10.

%o (Python)

%o x = [1] # To count the number in the sequence

%o y = [1] # To record the sequence itself

%o N = 20 # The number of terms to calculate

%o while len(x) < N:

%o x.append(x[-1] + 1)

%o # The next number in the sequence will be divisible by x[-1] so start

%o # looking at z which is the largest number divisible by x[-1] so far

%o z = y[-1]//x[-1] * x[-1] + x[-1]

%o # Now start counting up by x[-1] and check if the number is divisible by

%o # every integer less than x[-1]

%o while any([z%i != 0 for i in x]):

%o z += x[-1]

%o y.append(z)

%o print("{}\t {}\t".format(len(x),z))

%o (PARI) A003418(n) = if(n<1, n==0, 1/content(vector(n, k, 1/k)));

%o a(n) = {my(k=1);if(n>1,k=A003418(n)*(1+a(n-1)\A003418(n)));k} \\ _Jinyuan Wang_, Jul 22 2019

%Y Would be same as A003418 without the "increasing" condition.

%K nonn

%O 1,2

%A _Rian Rustvold_, Jul 16 2019

%E More terms from _Jinyuan Wang_, Jul 22 2019