|
|
A064219
|
|
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.
|
|
2
|
|
|
1, 1, 2, 3, 15, 24, 35, 119, 504, 720, 2519, 2519, 41040, 83160, 83160, 196559, 524160, 524160, 3160079, 3160079, 3160079, 3160079, 68468400, 68468400, 68468400, 68468400, 4724319600, 4724319600, 26702675999, 26702675999
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
EXAMPLE
|
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)).
|
|
PROG
|
(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
(Python)
from math import lcm
from itertools import product
from sympy.ntheory.modular import solve_congruence
if n == 1: return 1
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|