login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A272022 Look at the set of numbers obtained by permuting the digits of n in all possible ways, then remove n itself from the set. If the remaining numbers are all primes, then n is in the sequence. 0
13, 14, 16, 17, 20, 30, 31, 32, 34, 35, 37, 38, 50, 70, 71, 73, 74, 76, 79, 91, 92, 95, 97, 98, 110, 113, 118, 119, 131, 133, 199, 311, 337, 373, 733, 772, 775, 778, 779, 919, 991, 1118, 3337, 7771, 77779 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
If it exists, a(46) > 5*10^11. - Lars Blomberg, Mar 31 2018
LINKS
EXAMPLE
119 is in the sequence because every permutation of its digits excluding 119 (i.e., 191 and 911) is a prime.
11 is not in the sequence, because when 11 is removed from the set, no numbers are left.
MAPLE
lis := [];
for n from 1 to 10000 do
nn := convert(n, base, 10);
pp := combinat[permute](nn);
if nops(pp) = 1 then
next
end if;
lOk := true;
for p in pp do
if p = nn then
next: #exclude n
end if;
if `not`(isprime(convert(p, base, 10, 10^nops(p))[])) then
lOk := false; break
end if
end do;
if lOk then
lis := [op(lis), n]
end if
end do:
lis := lis;
MATHEMATICA
rnapQ[n_]:=Module[{p=Rest[FromDigits/@Permutations[IntegerDigits[ n]]]}, If[ Length[p]==0, False, AllTrue[p, PrimeQ]]]; Select[Range[80000], rnapQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jan 24 2019 *)
PROG
(PARI) isok(n) = {v = []; d = digits(n); for (k=0, (#d)!-1, p = numtoperm(#d, k); dp = vector(#d, j, d[p[j]]); np = subst(Pol(dp), x, 10); v = Set(concat(v, np)); ); v = setminus(v, Set(n)); if (#v == 0, return (0)); for (k=1, #v, if (!isprime(v[k]), return (0)); ); return (1); } \\ Michel Marcus, Apr 18 2016
(Python)
from sympy import isprime
from itertools import count, islice, permutations
def agen(): yield from (k for k in count(1) if len(set(s:=str(k)))!=1 and all((t:=int("".join(m)))==k or isprime(t) for m in permutations(s)))
print(list(islice(agen(), 45))) # Michael S. Branicky, Dec 29 2023
CROSSREFS
Cf. A003459. - Altug Alkan, Apr 18 2016
Sequence in context: A054031 A060275 A083984 * A079495 A076204 A267382
KEYWORD
nonn,base,more
AUTHOR
César Eliud Lozada, Apr 18 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 11:12 EDT 2024. Contains 371936 sequences. (Running on oeis4.)