cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A316787 Semipermutable Primes: One-digit primes and primes with 2 or more digits such that all permutations of their digits are primes except for permutations that place either 5 or even numbers in the units digit.

This page as a plain text file.
%I A316787 #18 Aug 31 2018 22:52:55
%S A316787 2,3,5,7,11,13,17,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,
%T A316787 101,107,113,131,149,181,199,223,227,229,241,251,277,281,283,311,337,
%U A316787 373,401,419,421,443,449,457,461,463,467,491,503,509,521,547,557,563,569,577,587,601,607
%N A316787 Semipermutable Primes: One-digit primes and primes with 2 or more digits such that all permutations of their digits are primes except for permutations that place either 5 or even numbers in the units digit.
%C A316787 Supersequence of A003459. The motivation of the sequence is to fill gaps in A003459.
%C A316787 The sequence contains all 1-digit primes, 20 2-digit primes (i.e., all 2-digit primes except 19), as opposed to only 9 2-digit primes in A003459, and 66 3-digit primes (as opposed to only 9 3-digit primes in A003459).
%C A316787 Also, the sequence contains 4-digit primes such as 4441 but also nontrivial ones such as 1181, 1811, 8111, which form an orbit of size 3 (see below), while there are no 4-digit primes in A003459.
%C A316787 If we call orbits the primes that can be obtained by such permutations, there are orbits of sizes 1,2,3, and 4 up to 3-digit primes.
%C A316787 In fact, there are only 3 orbits of size 4 up to 3-digit primes: {107, 17, 71, 701}, {149, 419, 491, 941} and {709, 79, 97, 907}.
%C A316787 It appears that there are no orbits of sizes larger than 4 for n-digit primes.
%C A316787 Permutations that have leading 0's are included: thus 409 is not in the sequence because 49 is not prime. - _Robert Israel_, Aug 31 2018
%H A316787 Robert Israel, <a href="/A316787/b316787.txt">Table of n, a(n) for n = 1..134</a>
%e A316787 127 is not in the sequence since 271 is prime but neither 217 nor 721 are; to be in the sequence all of these numbers would have to be prime, and they would form an orbit of size 4 (by Name, permutations of these numbers ending in 2 are not considered).
%e A316787 241 and 421 are in the sequence and form an orbit of size 2 since these primes can be obtained by permutations that forbid the units digit to be an even number.
%e A316787 569 and 659 are in the sequence since these primes can be obtained by permutations that forbid the units digit to be either 5 or an even number.
%p A316787 filter:= proc(n) local L,m,i,t;
%p A316787   if not isprime(n) then return false fi;
%p A316787   L:= convert(n,base,10);
%p A316787   m:=nops(L);
%p A316787   for i in select(t -> member(L[t],[1,3,7,9]), [$1..m]) do
%p A316787     for t in combinat:-permute(subsop(i=NULL, L)) do
%p A316787       if not isprime(L[i]+add(10^j*t[j],j=1..m-1)) then
%p A316787         return false fi
%p A316787   od od;
%p A316787   true
%p A316787 end proc:
%p A316787 select(filter, [2,seq(i,i=3..2000,2)]); # _Robert Israel_, Aug 31 2018
%t A316787 Select[Prime@Range[120], AllTrue[FromDigits /@ Permutations[IntegerDigits@ #], PrimeQ[#] || MemberQ[{0, 2, 4, 5, 6, 8}, Mod[#, 10]] &] &] (* _Giovanni Resta_, Jul 14 2018 *)
%Y A316787 Contains A003459, A105976, A105978, A105979, A105980, A105982.
%K A316787 nonn,base
%O A316787 1,1
%A A316787 _Enrique Navarrete_, Jul 13 2018