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.
%I A069567 #55 Apr 25 2025 16:00:27 %S A069567 1913,18379,19013,25013,34613,35617,35879,36979,37379,37813,40013, %T A069567 40213,40639,45613,48091,49279,51613,55313,56179,56713,58613,63079, %U A069567 63179,64091,65479,66413,74779,75913,76213,76579,76679,85313,88379,90379,90679,93113,94379,96079 %N A069567 Smaller of two consecutive primes which are anagrams of each other. %C A069567 Smaller members of Ormiston prime pairs. %C A069567 Given the n-th prime, it is occasionally possible to form the (n+1)th prime using the same digits in a different order. Such a pair is called an Ormiston pair. %C A069567 Ormiston pairs occur rarely but randomly. It is thought that there are infinitely many but this has not been proved. They always differ by a multiple of 18. Ormiston triples also exist - see A075093. %C A069567 "Anagram" means that both primes must not only use the same digits but must use each digit the same number of times. [From _Harvey P. Dale_, Mar 06 2012] %C A069567 Dickson's conjecture would imply that the sequence is infinite, e.g. that there are infinitely many k for which 1913+3972900*k and 1931+3972900*k form an Ormiston pair. - _Robert Israel_, Feb 23 2017 %D A069567 Andy Edwards, Ormiston Pairs, Australian Mathematics Teacher, Vol. 58, No. 2 (2002), pp. 12-13. %H A069567 Charles R Greathouse IV, <a href="/A069567/b069567.txt">Table of n, a(n) for n = 1..10000</a> %H A069567 Jens Kruse Andersen, <a href="http://primerecords.dk/ormiston_tuples.htm">Ormiston Tuples</a> %H A069567 Andy Edwards, <a href="https://web.archive.org/web/20200401140701/https://www.aamt.edu.au/content/download/742/19588/file/amt-s.pdf">Ormiston Pairs</a> [Archive machine link]; <a href="/A069567/a069567.pdf">local copy</a> [with permission] %H A069567 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/RearrangementPrimePair.html">Rearrangement Prime Pair</a>. %e A069567 1913 and 1931 are two successive primes. %e A069567 Although 179 and 197 are composed of the same digits, they do not form an Ormiston pair as several other primes intervene (i.e. 181, 191, 193). %p A069567 N:= 10^6: # to get all terms <= N %p A069567 R:= NULL: p:= 3: q:= 5: %p A069567 while p <= N do %p A069567 p:= q; %p A069567 q:= nextprime(q); %p A069567 if q-p mod 18 = 0 and sort(convert(p,base,10)) = sort(convert(q,base,10)) then %p A069567 R:= R, p %p A069567 fi %p A069567 od: %p A069567 R; # _Robert Israel_, Feb 23 2017 %t A069567 Prime[ Select[ Range[10^4], Sort[ IntegerDigits[ Prime[ # ]]] == Sort[ IntegerDigits[ Prime[ # + 1]]] & ]] %t A069567 a = {1}; b = {2}; Do[b = Sort[ IntegerDigits[ Prime[n]]]; If[a == b, Print[ Prime[n - 1], ", ", Prime[n]]]; a = b, {n, 1, 10^4}] %t A069567 Transpose[Select[Partition[Prime[Range[8600]],2,1],Sort[IntegerDigits[ First[#]]] == Sort[ IntegerDigits[Last[#]]]&]][[1]] (* _Harvey P. Dale_, Mar 06 2012 *) %o A069567 (PARI) is(n)=isprime(n)&&vecsort(Vec(Str(n)))==vecsort(Vec(Str(nextprime(n+1)))) \\ _Charles R Greathouse IV_, Aug 09 2011 %o A069567 (PARI) p=2;forprime(q=3,1e5,if((q-p)%18==0&&vecsort(Vec(Str(p)))==vecsort(Vec(Str(q))),print1(p", "));p=q) \\ _Charles R Greathouse IV_, Aug 09 2011, minor edits by _M. F. Hasler_, Oct 11 2012 %o A069567 (Haskell) %o A069567 import Data.List (sort) %o A069567 a069567 n = a069567_list !! (n-1) %o A069567 a069567_list = f a000040_list where %o A069567 f (p:ps@(p':_)) = if sort (show p) == sort (show p') %o A069567 then p : f ps else f ps %o A069567 -- _Reinhard Zumkeller_, Apr 03 2015 %o A069567 (Python) %o A069567 from sympy import nextprime %o A069567 from itertools import islice %o A069567 def agen(): # generator of terms %o A069567 p, hp, q, hq = 2, "2", 3, "3" %o A069567 while True: %o A069567 if hp == hq: yield p %o A069567 p, q = q, nextprime(q) %o A069567 hp, hq = hq, "".join(sorted(str(q))) %o A069567 print(list(islice(agen(), 38))) # _Michael S. Branicky_, Feb 19 2024 %Y A069567 Cf. A072274, A075093, A161160, A066540. %Y A069567 Cf. A000040, A028906. %K A069567 nonn,base,nice %O A069567 1,1 %A A069567 _Amarnath Murthy_, Mar 24 2002 %E A069567 Comments and references from Andy Edwards (AndynGen(AT)aol.com), Jul 09 2002 %E A069567 Edited by _Robert G. Wilson v_, Jul 15 2002 and Aug 29 2002 %E A069567 Minor edits by _Ray Chandler_, Jul 16 2009