The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A132468 Longest gap between numbers relatively prime to n. 4
0, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 1, 3, 2, 1, 1, 3, 1, 3, 2, 3, 1, 3, 1, 3, 1, 3, 1, 5, 1, 1, 2, 3, 2, 3, 1, 3, 2, 3, 1, 5, 1, 3, 2, 3, 1, 3, 1, 3, 2, 3, 1, 3, 2, 3, 2, 3, 1, 5, 1, 3, 2, 1, 2, 5, 1, 3, 2, 5, 1, 3, 1, 3, 2, 3, 2, 5, 1, 3, 1, 3, 1, 5, 2, 3, 2, 3, 1, 5, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3, 1, 5, 1, 3, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
Here "gap" does not include the endpoints.
a(n) is given by the maximum length of a run of numbers satisfying one congruence modulo each of n's distinct prime factors. It follows that if m is the number of distinct prime factors of n and each of n's prime factors is greater than m then a(n) = m. - Thomas Anton, Dec 30 2018
LINKS
Mario Ziller, John F. Morack, Algorithmic concepts for the computation of Jacobsthal's function, arXiv:1611.03310 [math.NT], 2016.
FORMULA
a(n) = 1 at every prime power.
EXAMPLE
E.g. n=3: the longest gap in 1, 2, 4, 5, 7, ... is 1, between 2 and 4, so a(3) = 1.
MAPLE
a:=[];
for n from 1 to 120 do
s:=[seq(j, j=1..4*n)];
rec:=0;
for st from 1 to n do
len:=0;
for i from 1 to n while gcd(s[st+i-1], n)>1 do len:=len+1; od:
if len>rec then rec:=len; fi;
od:
a:=[op(a), rec];
od:
a; # N. J. A. Sloane, Apr 18 2017
MATHEMATICA
a[ n_ ] := (Max[ Drop[ #, 1 ]-Drop[ #, -1 ] ]-1&)[ Select[ Range[ n+1 ], GCD[ #, n ]==1& ] ]
Do[Print[n, " ", a[n]], {n, 20000}]
CROSSREFS
Equals A048669(n) - 1.
Sequence in context: A348953 A095345 A342671 * A353235 A243915 A367482
KEYWORD
nonn
AUTHOR
Michael Kleber, Nov 16 2007
EXTENSIONS
Incorrect formula removed by Thomas Anton, Dec 30 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 6 06:26 EDT 2024. Contains 373115 sequences. (Running on oeis4.)