login
A374353
Least k such that prime(n) mod k = n or 0 if no such k exists.
0
0, 0, 0, 0, 6, 7, 10, 11, 14, 19, 20, 25, 14, 29, 16, 37, 21, 43, 24, 51, 26, 57, 30, 65, 36, 75, 38, 79, 40, 83, 32, 33, 52, 35, 38, 115, 40, 125, 64, 133, 46, 139, 74, 149, 76, 51, 82, 175, 89, 179, 91, 187, 94, 197, 101, 69, 106, 71, 109, 221, 74, 77, 122, 247
OFFSET
1,5
COMMENTS
We observe pairs of consecutive numbers: (6, 7), (10, 11), (19, 20), (32, 33), (93, 94), (118, 119), (242, 243), (302, 303), (215, 216), ...
As k > n we have prime(n) = m*k + n. As prime(n) > n for all n we have m >= 1 and so prime(n) >= k + n > n + n = 2*n. But prime(n) < 2*n for n <= 4 so a(n) = 0 for n <= 4. - David A. Corneth, Jul 08 2024
EXAMPLE
a(5) = 6 because prime(5) mod 6 = 11 mod 6 = 5, and there is no k < 6 such that prime(5) mod k = 5.
MAPLE
nn:=10^7:
for n from 1 to 100 do:
ii:=0:
for k from 1 to nn while(ii=0)
do:
if irem(ithprime(n), k)=n
then ii:=1:printf(`%d, `, k):
else fi:
od:
if ii=0
then printf(`%d, `, 0):
else fi:
od:
MATHEMATICA
Table[k=1; While[Mod[Prime[n], k] !=n, k++]; k, {n, 5, 70}]
PROG
(PARI) a(n) = if (n<5, 0, my(k=1); while((prime(n) % k) != n, k++); k); \\ Michel Marcus, Jul 06 2024
(PARI) first(n) = {
n = max(n, 4);
my(res = vector(n), t = 4);
forprime(p = 11, oo,
t++;
if(t > n,
return(res);
);
d = divisors(p - t);
for(i = 1, #d,
if(d[i] > t,
res[t] = d[i];
break
);
);
);
} \\ David A. Corneth, Jul 07 2024
CROSSREFS
Sequence in context: A374528 A372587 A118957 * A037303 A135121 A309854
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jul 06 2024
STATUS
approved