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.

A162872 Primes p such that p-1 and p+1 each contain at least one squared prime in their prime factorization.

Original entry on oeis.org

19, 149, 197, 199, 293, 307, 349, 491, 523, 557, 577, 739, 773, 883, 1013, 1051, 1061, 1151, 1171, 1277, 1451, 1493, 1531, 1549, 1601, 1637, 1667, 1693, 1709, 1733, 1747, 1861, 1949, 2069, 2141, 2179, 2251, 2351, 2357, 2467, 2549, 2683, 2789, 2843, 2851
Offset: 1

Views

Author

Keywords

Comments

The selection criterion is that p-1 and p+1 are in the subsequence 4=2^2, 9=3^2, 12=2^2*3, 18=2*3^2, ... of nonsquarefree numbers (A013929) that actually display at least one square in their standard prime factorization.
So at least one of the e_i in p-1=product p_i^e_i, and at least one of the e_j in p+1=product p_j^e_j must equal 2. This is more stringent than being nonsquarefree, and the sequence becomes a subsequence of A075432.

Examples

			19 is in the sequence because 19 - 1 = 2*3^2 contains 3^2 and because 19 + 1 = 2^2*5 contains 2^2 in the factorization.
		

Crossrefs

Programs

  • Maple
    isA162872 := proc(n)
        if isprime(n) then
            isA038109(n-1) and isA038109(n+1) ;
        else
            false;
        end if;
    end proc:
    n := 1:
    for c from 1 to 50000 do
        if isA162872(c) then
            printf("%d %d\n",n,c) ;
            n := n+1 ;
    end if; # R. J. Mathar, Dec 08 2015
    N:= 10^5: # to get all terms < N, where N is even
    V:= Vector(N/2):
    for i from 1 do
      p:= ithprime(i);
      if p^2 > N+1 then break fi;
      if p = 2 then inds:= 2*[seq(i, i=1..floor(N/4), 2)]
      else inds:= p^2*select(t -> t mod p <> 0, [$1..floor(N/2/p^2)])
      fi;
      V[inds]:= 1;
    od:
    select(t -> V[(t-1)/2] = 1 and V[(t+1)/2] = 1 and isprime(t), [seq(t, t=3..N, 2)]); # Robert Israel, Dec 08 2015
  • Mathematica
    f[n_]:=Module[{a=m=0},Do[If[FactorInteger[n][[m,2]]==2,a=1],{m,Length[FactorInteger[n]]}]; a]; lst={};Do[p=Prime[n];If[f[p-1]==1&&f[p+1]==1,AppendTo[lst,p]], {n,7!}];lst
    ospQ[n_]:=AnyTrue[FactorInteger[n+1][[;;,2]],#==2&]&&AnyTrue[FactorInteger[n-1][[;;,2]],#==2&]; Select[Prime[Range[500]],ospQ] (* Harvey P. Dale, May 11 2025 *)

Formula

{p in A000040: p+1 in A038109 and p-1 in A038109}. - R. J. Mathar, Dec 08 2015

Extensions

Role of squarefree numbers clarified by R. J. Mathar, Jul 31 2007