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.

A107845 Transposable-digit primes: Primes such that if any single pair of adjacent digits is transposed the result is a prime.

This page as a plain text file.
%I A107845 #21 Sep 25 2019 09:28:05
%S A107845 2,3,5,7,11,13,17,31,37,71,73,79,97,113,131,137,179,199,277,311,331,
%T A107845 337,373,379,397,419,491,577,613,733,811,877,911,919,977,991,1013,
%U A107845 1031,1091,1117,1213,1231,1579,1777,1811,1999,2113,2131,2399,2411,2677,2699,2719
%N A107845 Transposable-digit primes: Primes such that if any single pair of adjacent digits is transposed the result is a prime.
%C A107845 A single transposition error (of decimal digits) when recording or communicating such a prime still results in a prime (possibly the same prime). A003459 and A004022 (its subsequence) are subsequences. A003459 is also a subsequence of A068652.
%H A107845 Giovanni Resta, <a href="/A107845/b107845.txt">Table of n, a(n) for n = 1..5000</a> (first 3565 terms from Felix Fröhlich)
%e A107845 137 is a term because it is prime and 173 and 317 are also prime.
%e A107845 173 is not a term because 713 is not prime (even though 173 and 137 are prime). {Hence none of 137,173,317,371,713,731 is a term of A003459.}
%e A107845 3119 is a term because it is prime and 1319 and 3191 are primes.
%e A107845 As 3119, 1193, 1931 and 9311 are all prime, 3119 is also a term of A068652.
%e A107845 Finally, although 1913 is also prime, neither 1139, 1391, 3911, 9113, nor 9131 is prime so 3119's twelve total permutations are not terms of A003459.
%t A107845 swap[lst_List, i_Integer] := Block[{lsu = lst}, ReplacePart[ lsu, {i -> lsu[[i + 1]], i + 1 -> lsu[[i]]}]]; fQ[n_] := Block[{id = IntegerDigits@ n, l = Floor@ Log10@ n}, And @@ Table[ PrimeQ@ FromDigits@ swap[id, j], {j, l}] == True]; Select[ Prime@ Range@ 500, fQ] (* _Robert G. Wilson v_, Nov 29 2014 *)
%o A107845 (PARI) eva(n) = subst(Pol(n), x, 10)
%o A107845 switchdigits(v, pos) = my(vt=v[pos]); v[pos]=v[pos+1]; v[pos+1]=vt; v
%o A107845 is(n) = my(d=digits(n)); for(k=1, #d-1, if(!ispseudoprime(eva(switchdigits(d, k))), return(0))); 1
%o A107845 forprime(p=1, , if(is(p), print1(p, ", "))) \\ _Felix Fröhlich_, Sep 21 2019
%Y A107845 Cf. A003459 (absolute primes), A004022 (repunit primes), A068652 (every cyclic permutation is prime).
%K A107845 base,nonn
%O A107845 1,1
%A A107845 _Rick L. Shepherd_, May 24 2005
%E A107845 Offset changed from 0 to 1 by _Felix Fröhlich_, Sep 21 2019