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.

This page as a plain text file.
%I A162872 #25 May 11 2025 19:00:05
%S A162872 19,149,197,199,293,307,349,491,523,557,577,739,773,883,1013,1051,
%T A162872 1061,1151,1171,1277,1451,1493,1531,1549,1601,1637,1667,1693,1709,
%U A162872 1733,1747,1861,1949,2069,2141,2179,2251,2351,2357,2467,2549,2683,2789,2843,2851
%N A162872 Primes p such that p-1 and p+1 each contain at least one squared prime in their prime factorization.
%C A162872 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.
%C A162872 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.
%H A162872 R. J. Mathar and Robert Israel, <a href="/A162872/b162872.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..536 from R. J. Mathar)
%F A162872 {p in A000040: p+1 in A038109 and p-1 in A038109}. - _R. J. Mathar_, Dec 08 2015
%e A162872 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.
%p A162872 isA162872 := proc(n)
%p A162872     if isprime(n) then
%p A162872         isA038109(n-1) and isA038109(n+1) ;
%p A162872     else
%p A162872         false;
%p A162872     end if;
%p A162872 end proc:
%p A162872 n := 1:
%p A162872 for c from 1 to 50000 do
%p A162872     if isA162872(c) then
%p A162872         printf("%d %d\n",n,c) ;
%p A162872         n := n+1 ;
%p A162872 end if; # _R. J. Mathar_, Dec 08 2015
%p A162872 N:= 10^5: # to get all terms < N, where N is even
%p A162872 V:= Vector(N/2):
%p A162872 for i from 1 do
%p A162872   p:= ithprime(i);
%p A162872   if p^2 > N+1 then break fi;
%p A162872   if p = 2 then inds:= 2*[seq(i, i=1..floor(N/4), 2)]
%p A162872   else inds:= p^2*select(t -> t mod p <> 0, [$1..floor(N/2/p^2)])
%p A162872   fi;
%p A162872   V[inds]:= 1;
%p A162872 od:
%p A162872 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
%t A162872 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
%t A162872 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 *)
%Y A162872 Cf. A038109, A162870.
%K A162872 nonn
%O A162872 1,1
%A A162872 _Vladimir Joseph Stephan Orlovsky_, Jul 15 2009
%E A162872 Role of squarefree numbers clarified by _R. J. Mathar_, Jul 31 2007