|
|
A187824
|
|
a(n) is the largest m such that n is congruent to -1, 0 or 1 mod k for all k from 1 to m.
|
|
11
|
|
|
3, 4, 5, 6, 3, 4, 4, 5, 3, 6, 4, 4, 3, 5, 5, 4, 3, 6, 5, 5, 3, 4, 6, 6, 3, 4, 4, 7, 3, 6, 4, 4, 3, 7, 7, 4, 3, 5, 5, 8, 3, 4, 5, 5, 3, 4, 4, 8, 3, 5, 4, 4, 3, 9, 5, 4, 3, 6, 6, 6, 3, 4, 5, 6, 3, 4, 4, 5, 3, 10, 4, 4, 3, 5, 5, 4, 3, 6, 5, 5, 3, 4, 7, 7, 3, 4, 4, 6, 3, 7, 4, 4, 3, 6, 6, 4, 3, 5, 5, 6, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,1
|
|
COMMENTS
|
This sequence and A187771 and A187761 are winners in the contest held at the 2013 AMS/MAA Joint Mathematics Meetings. - T. D. Noe, Jan 14 2013
If n = t!-1 then a(n) >= t, so sequence is unbounded. - N. J. A. Sloane, Dec 30 2012
First occurrence of k = 3, 4, 5, ...: 2, 3, 4, 5, 29, 41, 55, 71, 881, 791, 9360, 10009, 1079, 30239, (17 unknown), 246960, (19 unknown), 636481, 1360800, 3160079, (23 unknown), 2162161, 266615999, 39412801 (27 unknown), 107881201, ... Searched up to 3*10^9. - Robert G. Wilson v, Dec 31 2012
|
|
LINKS
|
|
|
FORMULA
|
If n == 0 (mod 20), then a(n-2) = a(n+2) = 3, while a(n) = 5,5,6, 5,5,8, 5,5,6, 5,5,6, 5,5,7, 5,5,6, 5,5,7, ... with records a(20) = 5, a(60) = 6, a(120) = 8, a(720) = 10, a(2520) = 12, a(9360) = 13, ... If n == 0 (mod 5), but is not a multiple of 20, then always a(n-2) = a(n+2) = 4, while a(n) = 6,3,5, 6,3,7, 5,3,9, 6,3,5, 7,3,6, 5,3,6, 7,3,5, ... - Vladimir Shevelev, Dec 31 2012
a(n)=3 iff n == 2 (mod 4). a(n)=4 iff n == 3, 7, 8, 12, 13, 17 (mod 20), i.e., n == 2 or 3 (mod 5) but not n == 2 (mod 4). In the same way one can obtain a covering set for any value taken by a(n), this is actually nothing else than the definition. For example, n == 2, 3 or 4 (mod 6) but not 2 or 3 (mod 5) nor 2 (mod 4) yields a(n)=5 iff n == 4, 9, 15, 16, 20, 21, 39, 40, 44, 45, 51 or 56 (mod 60), etc. - M. F. Hasler, Dec 31 2012
|
|
EXAMPLE
|
For n = 6, a(6) = 3 as follows.
m Residue of 6 (mod m)
1 0
2 0
3 0
4 2
5 1
6 0
7 -1
|
|
MAPLE
|
local j, r;
for j from 4 do
r:= mods(n, j);
if r <> r^3 then return j-1 end if
end do
|
|
MATHEMATICA
|
f[n_] := Block[{k = 4, r}, While[r = Mod[n, k]; r < 2 || k - r < 2, k++]; k - 1]; Array[f, 101, 2] (* Robert G. Wilson v, Dec 31 2012 *)
|
|
PROG
|
(Small Basic)
For n = 1 To 100
For m = 1 To 100
i = Math.Round(n/m)
d = Math.Abs(n-i*m)
If d > 1 Then
a = m - 1
Goto OUT
Else
EndIf
EndFor
OUT:
TextWindow.Write(n+" ")
TextWindow.Write(a+" ")
TextWindow.WriteLine(" ")
EndFor
(PARI) A187824(n)={n++>2 && for(k=4, oo, n%k>2 && return(k-1))} \\ M. F. Hasler, Dec 31 2012, minor edits Aug 20 2020
(Python)
from gmpy2 import t_mod
k = 1
while t_mod(n+1, k) < 3:
k += 1
(Python)
def a(n):
m=1
while abs(n%m) < 2:
m += 1
return m
[a(n) for n in range(1, 100)]
|
|
CROSSREFS
|
For values of n which set a new record see A220891.
|
|
KEYWORD
|
nonn,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|