%I #21 Jun 21 2023 08:03:06
%S 1,1,2,3,15,24,35,119,504,720,2519,2519,41040,83160,83160,196559,
%T 524160,524160,3160079,3160079,3160079,3160079,68468400,68468400,
%U 68468400,68468400,4724319600,4724319600,26702675999,26702675999
%N a(1) = 1; a(n) > 0; for each k from 1 to n, k divides a(n) or a(n)+1 and a(n) is the least such integer.
%H Chai Wah Wu, <a href="/A064219/b064219.txt">Table of n, a(n) for n = 1..112</a>
%H Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a064/A064219.java">Java program</a> (github)
%e a(5)=15 because (2 divides a(5)+1) and (3 divides a(5)) and (4 divides a(5)+1) and (5 divides a(5)).
%o (PARI) { a=1; for (n=1, 100, if (a%n && (a+1)%n, until (b, b=1; a++; for (k=1, n, if (a%k && (a+1)%k, b=0; break)))); write("b064219.txt", n, " ", a) ) } \\ _Harry J. Smith_, Sep 10 2009
%o (Python)
%o from math import lcm
%o from itertools import product
%o from sympy.ntheory.modular import solve_congruence
%o def A064219(n):
%o if n == 1: return 1
%o alist, blist, c, klist = [], [], 1, list(range(n,1,-1))
%o while klist:
%o k = klist.pop(0)
%o if not c%k:
%o blist.append(k)
%o else:
%o c = lcm(c,k)
%o alist.append(k)
%o for m in klist.copy():
%o if not k%m:
%o klist.remove(m)
%o for d in product([0,1],repeat=len(alist)):
%o x = solve_congruence(*list(zip(d,alist)))
%o if x is not None:
%o y = x[0]
%o if y > 1:
%o for b in blist:
%o if y%b > 1:
%o break
%o else:
%o if y < c:
%o c = y
%o return int(c-1) # _Chai Wah Wu_, Jun 19 2023
%K easy,nonn
%O 1,3
%A _Don Reble_, Sep 21 2001
|