A094535 a(n) is the smallest integer m such that A039995(m)=n.
1, 2, 13, 23, 113, 131, 137, 1013, 1031, 1273, 1237, 1379, 6173, 10139, 10193, 10379, 10397, 10937, 12397, 12379, 36137, 36173, 101397, 102371, 101937, 102973, 103917, 106937, 109371, 109739, 123797, 123917, 123719, 346137, 193719, 346173
Offset: 0
Examples
a(6) = 137 because 137 is the smallest number m such that A039995(m) = 6; the six numbers 3, 7, 13, 17, 37 & 137 are primes. See also A205956 for a(100) = 39467139.
Links
- Giovanni Resta, Table of n, a(n) for n = 0..500 (first 101 terms from Reinhard Zumkeller)
- Carlos Rivera, Puzzle 265. Primes embedded, The Prime Puzzles & Problems Connection.
- Reinhard Zumkeller, Illustration of initial terms
Programs
-
Haskell
import Data.List (elemIndex) import Data.Maybe (fromJust) a094535 n = a094535_list !! n a094535_list = map ((+ 1) . fromJust . (`elemIndex` a039995_list)) [0..] -- Reinhard Zumkeller, Feb 01 2012
-
Mathematica
cnt[n_] := Count[ PrimeQ@ Union[ FromDigits /@ Subsets[ IntegerDigits[n]]], True]; a[n_] := Block[{k = 1}, While[cnt[k] != n, k++]; k]; Array[a, 21, 0] (* Giovanni Resta, Jun 16 2017 *)
-
Python
from sympy import isprime from itertools import chain, combinations as combs, count, islice def powerset(s): # nonempty subsets of s return chain.from_iterable(combs(s, r) for r in range(1, len(s)+1)) def A039995(n): ss = set(int("".join(s)) for s in powerset(str(n))) return sum(1 for k in ss if isprime(k)) def agen(): adict, n = dict(), 0 for k in count(1): v = A039995(k) if v not in adict: adict[v] = k while n in adict: yield adict[n]; n += 1 print(list(islice(agen(), 36))) # Michael S. Branicky, Aug 07 2022
Comments