Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #16 Feb 16 2021 01:01:57
%S 5,11,13,19,29,31,43,71,97,101,109,151,157,163,191,197,211,223,227,
%T 239,241,269,281,283,347,359,401,409,421,433,443,503,541,571,617,643,
%U 677,691,727,733,739,751,773,787,839,877,907,919,929,937,953,971,977,991
%N Primes p such that the sum of the digits of the p-th lower twin prime is a lower twin prime.
%e The 13th lower twin prime is 179. 1+7+9=17 the lower twin prime of the twin pair (17,19).
%o (PARI) sdtwtwnp(n) = { local(x,y); forprime(x=1,n, y=sumdigits(twinl(x)); if(istwin(y)<0, print1(x",") ) ) }
%o sumdigits(n) = { local(x,j,s=0); x=digits(n); for(j=1,length(x), s+=x[j]; ); return(s) }
%o digits(n) = { return(eval(Vec(Str(n)))) }
%o twinl(n) = { local(c,x); c=0; x=1; while(c<n, if(isprime(prime(x)+2),c++); x++; ); return(prime(x-1)) }
%o istwin(n) = /* Return -1 if n is a lower twin,1 if upper, otherwise return 0 */ { local(p1,p2); if(isprime(n), p1=n-2; p2=n+2; if(isprime(p1),return(1)); if(isprime(p2),return(-1)); return(0) ) }
%Y Cf. A001359.
%K easy,nonn,base
%O 1,1
%A _Cino Hilliard_, Mar 13 2005