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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

3, 17, 487, 947, 947, 38639, 38639
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Apr 25 2015

Keywords

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

Examples

			a(1) = 3 because 3 + 1 = 4 is not squarefree, 3 + 2 = 5 is squarefree, 3 is prime.
		

Crossrefs

Programs

  • 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 *)
  • 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

Extensions

a(3) corrected, a(6)-a(7) added by Charles R Greathouse IV, Apr 27 2015

A254069 a(n) = smallest k such that none of 4*k - 4*j + 2 and 4*k + 4*j - 2, j = 0, 1, 2, .. n, are squarefree.

Original entry on oeis.org

13, 13, 1263, 837140
Offset: 0

Views

Author

Juri-Stepan Gerasimov, May 03 2015

Keywords

Comments

a(4) > 10^8.

Examples

			a(0) = 13 because none of 4*13 - 4*0 + 2 = 54, 4*13 + 4*0 - 2 = 50 are squarefree,
a(1) = 13 because none of 4*13 - 4*1 + 2 = 50, 4*13 + 4*1 - 2 = 54 are squarefree,
a(2) = 1263 because none of 4*1263 - 4*2 + 2 = 5046, 4*1263 - 4*1 + 2 = 5050, 4*1263 + 4*1 - 2 = 5054, 4*1263 + 4*2 - 2 = 5058 are squarefree.
		

Crossrefs

Cf. A257115.

Programs

  • Mathematica
    {1}~Join~Table[k = 0; While[! And[NoneTrue[4 k + 2 # & /@ Range@ n, SquareFreeQ], NoneTrue[4 k - 2 # & /@ Range@ n, SquareFreeQ]], k++]; k, {n, 6}] (* Michael De Vlieger, May 09 2015, Version 10 *)
  • PARI
    ok(n,k)=for(j=1,n, if(issquarefree(4*k-4*j+2) || issquarefree(4*k+4*j-2), return(0))); 1
    a(n)=my(k); while(!ok(n,k++),); k \\ Charles R Greathouse IV, May 22 2015
Showing 1-2 of 2 results.