A380984 Primes p such that p*(p-1) consists of exactly two different decimal digits.
5, 7, 11, 17, 67, 101, 167, 1667, 166667, 666667, 66666667, 666666667, 1666666667, 66666666667, 166666666667, 166666666666667, 66666666666666666667
Offset: 1
Examples
a(5) = 67 is a term because it is prime and 67 * 66 = 4422 consists of digits 2 and 4.
Programs
-
Maple
p:= 1: R:= NULL: count:= 0: while count < 11 do p:= nextprime(p); if nops(convert(convert(p*(p-1),base,10),set)) = 2 then R:= R,p; count:= count+1 fi; od: R;
-
Mathematica
Select[Prime[Range[10^6]],Length[Union[IntegerDigits[#(#-1)]]]==2&] (* James C. McMahon, Feb 13 2025 *)
-
PARI
isok(k) = isprime(k) && #Set(digits(k*(k-1))) == 2; \\ Michel Marcus, Feb 11 2025
-
Python
from math import isqrt from itertools import count, combinations, product, islice from sympy import isprime def A380984_gen(): # generator of terms for n in count(1): c = [] for a in combinations('0123456789',2): if '0' in a or '2' in a or '6' in a: for b in product(a,repeat=n): if b[0] != '0' and b[-1] in {'0','2','6'} and b != (a[0],)*n and b != (a[1],)*n: m = int(''.join(b)) q = isqrt(m) if q*(q+1)==m and isprime(q+1): c.append(q+1) yield from sorted(c) A380984_list = list(islice(A380984_gen(),10)) # Chai Wah Wu, Feb 19 2025
Extensions
a(12)-a(17) from Jinyuan Wang, Feb 12 2025
Comments