[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A257116
Smallest prime p such that none of p + 1, p + 3,... p + 2n - 1 are squarefree and all of p + 2, p + 4,... p + 2n are squarefree.
1
3, 17, 487, 947, 947, 38639, 38639
OFFSET
1,1
COMMENTS
a(8) and higher do not exist because at least one of p+2, p+4, ..., p+16 is divisible by 9 unless p is divisible by 9, in which case it is not prime. - Charles R Greathouse IV, Apr 27 2015
EXAMPLE
a(1) = 3 because 3 + 1 = 4 is not squarefree, 3 + 2 = 5 is squarefree, 3 is prime.
MAPLE
p:= 0:
for i from 1 to 5000 do
p:= nextprime(p);
for n from 1 while numtheory:-issqrfree(p+2*n)
and not numtheory:-issqrfree(p+2*n-1) do
if not assigned(A[n]) then A[n]:= p
fi
od:
od:
seq(A[i], i=1..7); # Robert Israel, Apr 27 2015
MATHEMATICA
a[n_] := For[k=1, True, k++, p = Prime[k]; r = p + Range[1, 2*n-1, 2]; If[(And @@ ((!SquareFreeQ[#])& /@ r)) && And @@ (SquareFreeQ /@ (r+1)), Return[p]]]; Table[ a[n], {n, 1, 7}] (* Jean-François Alcover, Apr 28 2015 *)
PROG
(PARI) has(p, n)=for(i=1, 2*n, if(issquarefree(p+i)==i%2, return(0))); 1
a(n)=forprime(p=2, , if(has(p, n), return(p))) \\ Charles R Greathouse IV, Apr 27 2015
CROSSREFS
Sequence in context: A009719 A332758 A023150 * A305375 A128300 A292082
KEYWORD
nonn,fini,full
AUTHOR
EXTENSIONS
a(3) corrected, a(6)-a(7) added by Charles R Greathouse IV, Apr 27 2015
STATUS
approved