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!)
A271145 a(n) = k is the least number at which an isolated alternating run of nonsquarefree/squarefree (nsf/sf) numbers of size n starts. 1
2, 14, 482, 6346 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
A contiguous sequence of numbers satisfying the pattern sf sf nsf sf ... nsf sf nsf sf sf with k+1 nsf numbers alternating with k sf numbers that are bounded by a pair of sf numbers at both ends is called an isolated alternating nsf/sf run of size k. The left sf bounding number is the start of the run.
Any such run must start at an even number i and have an even size j, since for i odd i+3 is nsf, and for i even and j odd i+2*j+4 is nsf.
For all n>=0, a(n)+2 is divisible by 4.
a(4) > 5*10^9
LINKS
EXAMPLE
a(0) = 2 since 2, 3, 5 and 6 are sf while 4 is nsf.
a(2) = 482 since in the interval 482...494 the nsf/sf pattern is sf sf nsf sf nsf sf nsf sf nsf sf nsf sf sf and it is the first occurrence of that 13-number run.
MATHEMATICA
nsfRun[n_] := Module[{i=n}, While[!SquareFreeQ[i], i++]; i-n]
sfRun[n_] := Module[{i=n}, While[SquareFreeQ[i], i++]; i-n]
sfBlockSearch[i_] := Module[{searching=True, j=i, r, s}, While[searching, r=nsfRun[j]; s=sfRun[j+r]; If[s<2, j+=r+s, searching=False]]; j+r+s]
nsfsfPairQ[i_] := nsfRun[i]==1 && sfRun[i+1]==1
nsfsfEndQ[i_] := nsfRun[i]==1 && sfRun[i+1]>1
nsfsfRun[i_] := Module[{searching=True, count, j=i, s, e}, j=sfBlockSearch[j]; While[searching, count=0; s=j; While[nsfsfPairQ[j], count++; j+=2]; e=j; If[count==0 || !nsfsfEndQ[j], j=sfBlockSearch[j], searching=False]]; {s, e, count}]
a271145[{low_, high_}, b_] := Module[{i=low, k, k3, list=Table[{}, b]}, While[i<=high, k=nsfsfRun[i]; k3=Last[k]/2; If[list[[k3]]=={}, list[[k3]]=k[[1]]-2]; i=k[[2]]]; list]
a271145[{0, 10000}, 3] (* computes a(1), a(2), a(3) *)
CROSSREFS
Sequence in context: A324306 A160710 A365269 * A357508 A277134 A009997
KEYWORD
nonn,more
AUTHOR
Hartmut F. W. Hoft, Mar 31 2016
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 May 7 09:15 EDT 2024. Contains 372302 sequences. (Running on oeis4.)