A361246 a(n) is the smallest integer k > 1 that satisfies k mod j <= 1 for all integers j in 1..n.
2, 2, 3, 4, 16, 25, 36, 120, 505, 721, 2520, 2520, 41041, 83161, 83161, 196560, 524161, 524161, 3160080, 3160080, 3160080, 3160080, 68468401, 68468401, 68468401, 68468401, 4724319601, 4724319601, 26702676000, 26702676000
Offset: 1
Keywords
Examples
a(7)=36 since 36 mod 7 = 1, 36 mod 6 = 0, 36 mod 5 = 1, 36 mod 4 = 0, 36 mod 3 = 0, 36 mod 2 = 0, 36 mod 1 = 0 and 36 is the smallest integer greater than 1 where all of these remainders are 1 or less.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..112
Programs
-
PARI
isok(k, n) = for (j=1, n, if ((k % j) > 1, return(0))); return(1); a(n) = my(k=2); while(!isok(k, n), k++); k; \\ Michel Marcus, Mar 17 2023
-
Python
final=100 k=2 for n in range(1, final+1): j = n+1 while (j > 1): j -= 1 if k%j>1: k += j-(k%j) j = n+1 print(k)
-
Python
from math import lcm from itertools import product from sympy.ntheory.modular import solve_congruence def A361246(n): if n == 1: return 2 alist, blist, c, klist = [], [], 1, list(range(n,1,-1)) while klist: k = klist.pop(0) if not c%k: blist.append(k) else: c = lcm(c,k) alist.append(k) for m in klist.copy(): if not k%m: klist.remove(m) for d in product([0,1],repeat=len(alist)): x = solve_congruence(*list(zip(d,alist))) if x is not None: y = x[0] if y > 1: for b in blist: if y%b > 1: break else: if y < c: c = y return int(c) # Chai Wah Wu, Jun 19 2023
Formula
a(n) = A064219(n)+1. - Chai Wah Wu, Jun 19 2023