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 A382127 #40 Mar 19 2025 23:20:59 %S A382127 3,131,173,4391,4746616799 %N A382127 Smallest prime p with n distinct digits, such that for each digit of p, 2*p*(digit) + 1 is prime. %C A382127 The sequence is proven to be finite by definition and by nature, containing only up to 7 terms (though it is uncertain if all 7 exist). This is because in base 10 there are 10 digits, excluding 0 that's 9. There are always 2 digits d_1 and d_2, such that 2*p*d_1 + 1 and 2*p*d_2 + 1 has an ending digit of 5. The (d_1,d_2) for the ending digits of p are: 1->(2,7), 3->(4,9), 7->(1,6), 9->(3,8). We exclude any prime with a digit 0, because 2*p*(0) + 1 is never prime. %C A382127 The form 2*p*(digit) + 1 ensures a chance of primality, as p*(odd) + 1 is always composite. %C A382127 Under 2*p*(digit) + 1, every term with a digit 1 is also a Sophie-Germain prime (see A005384). %e A382127 a(2) = 131, because 131 has exactly 2 distinct digits (1,3), and 2*131*1 + 1 and 2*131*3 + 1 are both prime. %o A382127 (Python) %o A382127 from sympy import isprime %o A382127 from itertools import count %o A382127 def a(n): %o A382127 return next(p for p in count(2) if isprime(p) and len(set(str(p)))==n and '0' not in str(p) and all(isprime(2*p*int(d)+1) for d in set(str(p)))) %o A382127 (PARI) isok(k, n) = my(d=Set(digits(k))); if (#d != n, return(0)); for (i=1, #d, if (!isprime(2*k*d[i]+1), return(0)); ); return(1); %o A382127 a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p; \\ _Michel Marcus_, Mar 18 2025 %Y A382127 Subsequence of A382199. %Y A382127 Cf. A000040, A005384, A382179, A382198. %K A382127 nonn,base,fini,full %O A382127 1,1 %A A382127 _Jakub Buczak_, Mar 16 2025 %E A382127 a(5) from _Michel Marcus_, Mar 18 2025