cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A257116 #30 May 02 2015 16:28:21
%S A257116 3,17,487,947,947,38639,38639
%N 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.
%C A257116 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
%e A257116 a(1) = 3 because 3 + 1 = 4 is not squarefree, 3 + 2 = 5 is squarefree, 3 is prime.
%p A257116 p:= 0:
%p A257116 for i from 1 to 5000 do
%p A257116   p:= nextprime(p);
%p A257116   for n from 1 while numtheory:-issqrfree(p+2*n)
%p A257116        and not numtheory:-issqrfree(p+2*n-1) do
%p A257116         if not assigned(A[n]) then A[n]:= p
%p A257116           fi
%p A257116     od:
%p A257116 od:
%p A257116 seq(A[i],i=1..7); # _Robert Israel_, Apr 27 2015
%t A257116 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 *)
%o A257116 (PARI) has(p,n)=for(i=1,2*n,if(issquarefree(p+i)==i%2, return(0))); 1
%o A257116 a(n)=forprime(p=2,, if(has(p,n), return(p))) \\ _Charles R Greathouse IV_, Apr 27 2015
%Y A257116 Cf. A257108, A257115.
%K A257116 nonn,fini,full
%O A257116 1,1
%A A257116 _Juri-Stepan Gerasimov_, Apr 25 2015
%E A257116 a(3) corrected, a(6)-a(7) added by _Charles R Greathouse IV_, Apr 27 2015