For circle S2=x2+y2+16x+12y+p2=0, the centre is (−8,−6) and radius is √(−8)2+(−6)2−p2
Then √(−8)2+(−6)2−p2>0
−10≤p≤10
The circles should intersect each other at two points to have exactly two common tangents. So,
r1+r2>d>|r2−r1|
d=√(−8−0)2+(−6−0)2=10
r1+r2>d⇒7+√100−p2>10
⇒√100−p2>3
⇒100−p2>9
⇒−√91≤p≤√91
Also d>|r2−r1|
10>7−√100−p2 or
10>√100−p2−7
if 10>7−√100−p2
⇒√100−p2>−3 which is always true
If 10>√100−p2−7
p2>−189 which will be also always true
so −√91≤p≤√91
Now p∈Z so p=−9,−8,−7,.......8,9
⇒sum of all values p=0