login
Primes p such that p, q and p + q but not q - p have distinct digits, where q is the next prime after p.
0

%I #7 Mar 22 2024 17:22:23

%S 21067,46279,46831,47659,62017,124853,241567,347629,410257,428093,

%T 456901,476059,528719,638179,685471,789631,869521,1024357,2014357,

%U 2146853,2354167,3268549,3407659,3682457,3825649,4021357,4026571,4180679,4213567,4562791,7685401,8602417,20418637,41870293,76820453,390465721

%N Primes p such that p, q and p + q but not q - p have distinct digits, where q is the next prime after p.

%C Primes p = prime(k) such that p, prime(k+1) and p + prime(k+1) are in A010784 but p is not in A356196 (as prime(k+1) - p is not in A010784).

%e a(3) = 46831 is a term because it is prime, the next prime is 46853, and 46831, 46853 and 46831 + 46853 = 93684 have distinct digits but 46853 - 46831 = 22 does not.

%p isdd:= proc(n) local L;

%p L:= convert(n,base,10);

%p nops(L) = nops(convert(L,set))

%p end proc:

%p Res:= NULL:

%p for d from 1 to 9 do

%p for t in combinat:-permute([$0..9],d) do

%p if t[1] = 0 then next fi;

%p p:= add(t[i]*10^(d-i),i=1..d);

%p if isprime(p) then

%p q:= nextprime(p);

%p if not(isdd(q-p)) and isdd(q) and isdd(p+q) then

%p Res:= Res,p;

%p fi

%p fi

%p od od:

%p Res;

%Y Cf. A010784, A356196.

%K nonn,fini,full,base

%O 1,1

%A _Zak Seidov_ and _Robert Israel_, Mar 19 2024