login
A306612
a(n) is the least integer k > 2 such that the remainder of -k modulo p is strictly increasing over the first n primes.
6
3, 4, 7, 8, 16, 16, 157, 157, 16957, 19231, 80942, 82372, 82372, 9624266, 19607227, 118867612, 4968215191, 31090893772, 118903377091, 187341482252, 1784664085208, 12330789708022, 68016245854132, 68016245854132, 10065964847743822, 74887595879692807, 1825207861455319267, 98403562254816509476, 283462437415903129597, 2126598918934702375802
OFFSET
1,1
COMMENTS
0, 1, and 2 satisfy this condition for all p, so this sequence starts at 3. The growth of this sequence is much more irregular than that of the companion sequence A306582.
EXAMPLE
a(n) modulo 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, ...
===== ==================================================
3 1, 0, 2, 4, 8, 10, 14, 16, 20, 26, 28, ...
4 0, 2, 1, 3, 7, 9, 13, 15, 19, 25, 27, ...
7 1, 2, 3, 0, 4, 6, 10, 12, 16, 22, 24, ...
8 0, 1, 2, 6, 3, 5, 9, 11, 15, 21, 23, ...
16 0, 2, 4, 5, 6, 10, 1, 3, 7, 13, 15, ...
157 1, 2, 3, 4, 8, 12, 13, 14, 4, 17, 29, ...
16957 1, 2, 3, 4, 5, 8, 9, 10, 17, 8, 0, ...
19231 1, 2, 4, 5, 8, 9, 13, 16, 20, 25, 20, ...
80942 0, 1, 3, 6, 7, 9, 12, 17, 18, 26, 30, ...
PROG
(PARI) isok(k, n) = {my(last = -1, cur); for (i=1, n, cur = -k % prime(i); if (cur <= last, return (0)); last = cur; ); return (1); }
a(n) = {my(k=3); while(!isok(k, n), k++); k; } \\ Michel Marcus, Jun 04 2019
(Python)
from sympy import prime
def A306612(n):
plist, x = [prime(i) for i in range(1, n+1)], 3
rlist = [-x % p for p in plist]
while True:
for i in range(n-1):
if rlist[i] >= rlist[i+1]:
break
else:
return x
for i in range(n):
rlist[i] = (rlist[i] - 1) % plist[i]
x += 1 # Chai Wah Wu, Jun 15 2019
CROSSREFS
Cf. A306582.
Sequence in context: A037013 A050069 A219019 * A117587 A359747 A244930
KEYWORD
nonn,hard
AUTHOR
Charlie Neder, Jun 03 2019
EXTENSIONS
a(16)-a(19) from Daniel Suteu, Jun 04 2019
a(20)-a(25) from Giovanni Resta, Jun 16 2019
a(26)-a(27) from Bert Dobbelaere, Jun 22 2019
a(28)-a(30) from Bert Dobbelaere, Sep 04 2019
STATUS
approved