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.

A258706 Absolute primes: every permutation of digits is a prime. Only the smallest representative of each permutation class is shown.

This page as a plain text file.
%I A258706 #41 Sep 23 2024 10:11:16
%S A258706 2,3,5,7,11,13,17,37,79,113,199,337,1111111111111111111,
%T A258706 11111111111111111111111
%N A258706 Absolute primes: every permutation of digits is a prime. Only the smallest representative of each permutation class is shown.
%C A258706 See the main entry, A003459, for further information and references cited below.
%C A258706 The next terms are the repunit primes (A004023) R(317), too large to be displayed here, and R(1031), too large even for a b-file. Johnson (1977) proves that subsequent terms must be of the form a*R(n) + b*10^k, with a and a+b in {1..9}, k < n, and n > 9*10^9 if b != 0. - _M. F. Hasler_, Jun 26 2018
%H A258706 M. F. Hasler, <a href="/A258706/b258706.txt">Table of n, a(n) for n = 1..15</a>
%H A258706 James Grime and Brady Haran, <a href="https://www.youtube.com/watch?v=cmJ18ViCUAI">Absolute Primes</a>, YouTube Numberphile video, 2024.
%t A258706 Flatten@{2, 3, 5, 7,
%t A258706   Table[Select[
%t A258706     Table @@
%t A258706       Prepend[Prepend[
%t A258706         Table[{A@k, A[k - 1], 4}, {k, 2, n}], {A[1], 4}],
%t A258706        Unevaluated[
%t A258706         Unevaluated[FromDigits[{1, 3, 7, 9}[[A /@ Range[n]]]]]]] //
%t A258706      Flatten,
%t A258706     Function[L,
%t A258706        And[PrimeQ[#],
%t A258706         And @@ PrimeQ[
%t A258706           FromDigits /@ (Permute[L, #] & /@
%t A258706              RandomPermutation[Length@L, 5])],
%t A258706         And @@ PrimeQ[FromDigits /@ Rest[Permutations[L]]]]]@
%t A258706       IntegerDigits@# &], {n, 2, 33}]}
%t A258706 (* Exhaustively searches thru 33 digits in ~7.5 sec, and up to 69 digits in 5 min, but cannot reach 317 digits. Not helpful in the light of Schroeppel's theorem that it's all repunits past 991. - _Bill Gosper_, Jan 06 2017 *)
%o A258706 (Haskell)
%o A258706 import Data.List (permutations, (\\))
%o A258706 a258706 n = a258706_list !! (n-1)
%o A258706 a258706_list = f a000040_list where
%o A258706    f ps'@(p:ps) | any (== 0) (map a010051' dps) = f ps
%o A258706                 | otherwise = p : f (ps' \\ dps)
%o A258706                 where dps = map read $ permutations $ show p
%o A258706 -- _Reinhard Zumkeller_, Jun 10 2015
%o A258706 (PARI)
%o A258706 {A=[2,5]; for(n=1, 317, my(D=[1,3,7,9], r=10^n\9); for(a=1,4, for(b=a^(n<3),4, for(j=0, if(b!=a,n-1), ispseudoprime(D[a]*r+(D[b]-D[a])*10^j)||next(2)); A=setunion(A, [r*D[a]+(D[b]-D[a])*10^if(b<a,n-1)])))); A}
%o A258706 is(n)={(n=digits(n))[#n]>=n[1] && #select(d->d,n[^1]-n[^-1])<2 && !for(i=1,(#n)^(n[#n]>1), isprime(fromdigits(n=concat(n[^1],n[1])))||return)} \\ By Johnson's theorem and minimality required here, the number must be of the form ab...b or a...ab (=> first difference of digits has at most 1 nonzero component) and then is sufficient to consider rotations of the digits.
%o A258706 \\ _M. F. Hasler_, Jun 26 2018
%Y A258706 Cf. A003459, A004023, A004022 (subsequence of repunit primes).
%K A258706 nonn,base
%O A258706 1,1
%A A258706 _N. J. A. Sloane_, Jun 09 2015