login
Primes k for which the concatenation, in ascending order, of all prime digit permutations, yields a prime.
2

%I #53 Dec 03 2025 10:07:34

%S 2,3,5,7,11,19,23,29,41,43,47,53,59,61,67,83,89,127,151,191,211,223,

%T 227,229,233,241,257,263,269,271,313,331,353,367,383,409,421,431,433,

%U 443,449,457,463,487,499,503,509,523,541,547,557,569,577,599,607,643,659

%N Primes k for which the concatenation, in ascending order, of all prime digit permutations, yields a prime.

%C If a prime p belongs to the sequence, then every prime digit permutation of p (excluding some primes with a leading zero) also belongs to the sequence.

%H Michael S. Branicky, <a href="/A390697/b390697.txt">Table of n, a(n) for n = 1..4137</a> (terms 1..1049 from Jean-Marc Rebert)

%e 127 is a term because the concatenation, in ascending order, of all prime permutations of its digits (namely, 127 and 271) yields 127271, which is also prime.

%e 1019 is a term because the concatenation, in ascending order, of all prime permutations of its digits (namely, 191, 911, 1019, 1091, 1109, 1901 and 9011) yields 19191110191091110919019011, which is also prime.

%e 13 is not a term since 1331 = 11^3 is not prime.

%t Select[Prime[Range[120]],PrimeQ[FromDigits[IntegerDigits[Sort[Select[FromDigits/@Permutations[IntegerDigits[#]],PrimeQ]]]//Flatten]]&] (* _James C. McMahon_, Dec 02 2025 *)

%o (Python)

%o from sympy import isprime

%o from sympy.utilities.iterables import multiset_permutations

%o def ok(n): return isprime(n) and isprime(int("".join(str(t) for p in multiset_permutations(str(n)) if isprime(t:=int("".join(p))))))

%o print([k for k in range(700) if ok(k)]) # _Michael S. Branicky_, Nov 15 2025

%Y Cf. A000040, A003459, A039999, A046811, A072857, A262988.

%K nonn,base

%O 1,1

%A _Jean-Marc Rebert_, Nov 15 2025