# [seqfan] Re: A055387

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Wed Jan 18 00:00:52 CET 2023

```On Tue, Jan 17, 2023 at 5:16 PM <israel at math.ubc.ca> wrote:

> A055387 is "Prime numbers such that some permutation (possibly omitting
> zeros) of digits is a prime." Well, the identity permutation of the digits
> of a prime is always a prime, so maybe it means nontrivial permutation.
> But
> no: the Data starts with 2, 3, 5, 7, 11, which have no nontrivial
> permutations of the digits. Should we perhaps remove those terms?
>

Yes. (I agree with your reasoning.)  And suggest adding the word "other":
"some *other* permutation of their digits (possibly omitting leading
zeroes) is a prime."

> Also, is it any zeros that can be omitted, or leading zeros?

It is permitted to permute "101" into "011" and then drop the leading zero.
We know this because "101" is in the sequence, and the only permutations of
those digits that exist are "101" (identity permutation), "110" (not
prime), and "011".
I don't know what it would mean to "drop *non*-leading zeroes" from a
digit-string that *is already a free permutation* of the input string! Just
permute the digits a little more to get the zero to the front, and then
drop it.

the digits of "(0)11" to produce "101"; under that interpretation "11"
should remain in the sequence. But that logic is both (1) ugly and (2)
insufficient to explain why the OP put "2, 3, 5, 7" in the sequence also.

Here's a small Python program that could be added to the entry. It
generates the expected output:

[13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 127, 131, 137,
139, 149, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251,
271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 359, 367,
373, 379, 389, 397].

def is_a055387(x):

if sympy.isprime(x):

for perm in itertools.permutations(str(x)):

p = int(''.join(perm))

if (p != x) and sympy.isprime(p):

return True

return False

print([x for x in range(400) if is_a055387(x)])
```