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 A376550 #42 Nov 30 2024 12:52:29 %S A376550 2,13,197,1097,10259,10273,10369,10723,10739,10937,13729,31729,38791, %T A376550 101267,101273,102139,102359,102367,102397,105379,107839,108793, %U A376550 109387,109537,109873,130579,150379,709831,1002739,1002973,1003879,1005937,1008379,1012369,1012379 %N A376550 Smallest primes that generate a record number of deranged primes (see Comments). %C A376550 A derangement is a permutation of the elements of a set in which no element appears in its original position. In the present case, elements and set stand for digits and number. %C A376550 When counting deranged primes, leading zeros are allowed. %C A376550 The respective number of deranged primes is: 0,1,2,5,6,8,9,10,12,14,15,17,18,... %C A376550 From _David A. Corneth_, Nov 28 2024: (Start) %C A376550 a(105) > 185000000. Likely a(105)..a(110) are 324908761, 364150279, 403157269, 504921367, 539021467, 724908361 and a(111) onwards > 10^9. If there is any term between 10^8 and 10^9 that is not listed in the b-file and not listed in the candidates I gave then any such term t meets A328447(t) > 103567778 and t > 18500000. (End) %C A376550 The likely terms a(105)..a(110) above are indeed terms. - _Michael S. Branicky_, Nov 30 2024 %H A376550 Michael S. Branicky, <a href="/A376550/b376550.txt">Table of n, a(n) for n = 1..138</a> %H A376550 David A. Corneth, <a href="/A376550/a376550_1.gp.txt">PARI program</a> %H A376550 Wikipedia, <a href="https://www.wikipedia.org/wiki/Derangement">Derangement</a> %e A376550 The smallest prime generating one deranged prime is 13, where the deranged prime is 31. The smallest prime generating two deranged primes is 197, where the deranged primes are 719 and 971. So, 13 and 197 are terms. Although 10753 is the smallest prime that generates 7 deranged primes it is not a term, since the smaller prime 10273 generates a record of 8 deranged primes. %t A376550 (* How to find a(4) among the 4-digit candidates, where z=9 is the number of derangements of a 4-element set *) %t A376550 Derangements[list_]:=Module[{n=Length[list],perms,isDerangement}, %t A376550 perms=Permutations[list];isDerangement[perm_]:=And@@Table[perm[[i]]!=list[[i]],{i,n}]; Select[perms,isDerangement]]; %t A376550 numberOfPrimeDerangements[n_]:=Length[Select[FromDigits/@Derangements[IntegerDigits[n]],PrimeQ]]; %t A376550 listOf4digitCandidates=Table[{z,Select[Prime/@Range[169,1229],numberOfPrimeDerangements[#]==z&,1]},{z,3,9}] %o A376550 (Python) %o A376550 from itertools import islice %o A376550 from sympy import isprime, nextprime %o A376550 from sympy.utilities.iterables import multiset_derangements as md %o A376550 def f(n): return len(set(tuple(d) for d in md(list(str(n))) if isprime(int("".join(d))))) %o A376550 def agen(): # generator of terms %o A376550 record, p = -1, 2 %o A376550 while True: %o A376550 v = f(p) %o A376550 if v > record: %o A376550 yield p %o A376550 record = v %o A376550 p = nextprime(p) %o A376550 print(list(islice(agen(), 26))) # _Michael S. Branicky_, Nov 27 2024 %o A376550 (PARI) \\ See Corneth link %Y A376550 Cf. A000040, A000166, A328447. %K A376550 nonn,base %O A376550 1,1 %A A376550 _Ivan N. Ianakiev_, Nov 27 2024 %E A376550 a(14) and beyond from _Michael S. Branicky_, Nov 27 2024 %E A376550 2 prepended by _David A. Corneth_, Nov 27 2024