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