login
Primes p whose index has a submultiset of their decimal digits.
1

%I #20 Sep 18 2023 18:42:24

%S 17,367,491,1327,1823,2039,2131,2143,2153,2693,4621,5417,5701,6481,

%T 6883,7459,7691,10723,11483,11593,12491,12497,12853,14723,15287,17093,

%U 24781,25849,26951,27091,27179,33569,33967,34367,35171,35809,39451,40283,41263,41543,41983,42437,45971

%N Primes p whose index has a submultiset of their decimal digits.

%C Number of terms < 10^k, k > 0: 0, 1, 3, 17, 132, 379, 1422, 7156, 39004, 237792, ...

%H Michael De Vlieger, <a href="/A365678/b365678.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) is 17 since 17 is the 7th prime;

%e a(2) is not 31 since it is the 11th prime;

%e a(2) is 367 since it is the 73rd prime;

%e a(3) is 491 since it is the 94th prime;

%e a(237793) = 10000865549 since it is the 455090018th prime; etc.

%t idx = 1; p = 2; lst = {}; While[p < 50001, If[ MemberQ[ Subsets[ Sort@ IntegerDigits@ p, IntegerLength@ idx], Sort@ IntegerDigits@ idx], AppendTo[lst, p]; Print[{p, idx}]]; idx++; p = NextPrime@p]; lst

%o (Python)

%o from sympy import nextprime

%o from itertools import islice

%o from collections import Counter

%o def agen(): # generator of terms

%o i, p = 1, 2

%o while True:

%o if Counter(str(i)) <= Counter(str(p)): yield p

%o i, p = i+1, nextprime(p)

%o print(list(islice(agen(), 43))) # _Michael S. Branicky_, Sep 15 2023

%Y Cf. A000040, A355418.

%K base,nonn

%O 1,1

%A _Robert G. Wilson v_, Sep 15 2023