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.

A361246 a(n) is the smallest integer k > 1 that satisfies k mod j <= 1 for all integers j in 1..n.

This page as a plain text file.
%I A361246 #34 Jun 21 2023 06:47:14
%S A361246 2,2,3,4,16,25,36,120,505,721,2520,2520,41041,83161,83161,196560,
%T A361246 524161,524161,3160080,3160080,3160080,3160080,68468401,68468401,
%U A361246 68468401,68468401,4724319601,4724319601,26702676000,26702676000
%N A361246 a(n) is the smallest integer k > 1 that satisfies k mod j <= 1 for all integers j in 1..n.
%H A361246 Chai Wah Wu, <a href="/A361246/b361246.txt">Table of n, a(n) for n = 1..112</a>
%F A361246 a(n) = A064219(n)+1. - _Chai Wah Wu_, Jun 19 2023
%e A361246 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.
%o A361246 (Python)
%o A361246 final=100
%o A361246 k=2
%o A361246 for n in range(1, final+1):
%o A361246     j = n+1
%o A361246     while (j > 1):
%o A361246         j -= 1
%o A361246         if k%j>1:
%o A361246               k += j-(k%j)
%o A361246               j = n+1
%o A361246     print(k)
%o A361246 (Python)
%o A361246 from math import lcm
%o A361246 from itertools import product
%o A361246 from sympy.ntheory.modular import solve_congruence
%o A361246 def A361246(n):
%o A361246     if n == 1: return 2
%o A361246     alist, blist, c, klist = [], [], 1, list(range(n,1,-1))
%o A361246     while klist:
%o A361246         k = klist.pop(0)
%o A361246         if not c%k:
%o A361246             blist.append(k)
%o A361246         else:
%o A361246             c = lcm(c,k)
%o A361246             alist.append(k)
%o A361246             for m in klist.copy():
%o A361246                 if not k%m:
%o A361246                    klist.remove(m)
%o A361246     for d in product([0,1],repeat=len(alist)):
%o A361246         x = solve_congruence(*list(zip(d,alist)))
%o A361246         if x is not None:
%o A361246             y = x[0]
%o A361246             if y > 1:
%o A361246                 for b in blist:
%o A361246                     if y%b > 1:
%o A361246                         break
%o A361246                 else:
%o A361246                     if y < c:
%o A361246                         c = y
%o A361246     return int(c) # _Chai Wah Wu_, Jun 19 2023
%o A361246 (PARI) isok(k, n) = for (j=1, n, if ((k % j) > 1, return(0))); return(1);
%o A361246 a(n) = my(k=2); while(!isok(k, n), k++); k; \\ _Michel Marcus_, Mar 17 2023
%Y A361246 Cf. A003418 (all remainders 0).
%Y A361246 Cf. A064219, A361247, A361248.
%K A361246 nonn
%O A361246 1,1
%A A361246 _Andrew Cogliano_, Mar 05 2023