A327820 Smallest prime with n holes in its decimal digits.
2, 19, 83, 89, 809, 1889, 4889, 46889, 48889, 468889, 688889, 3888889, 4888889, 28888889, 88884889, 288888889, 808888889, 4488888889, 8688888889, 48808888889, 48888888889, 288888888889, 888088888889, 1888888888889, 4888888888889, 48808888888889, 88848888888889
Offset: 0
Links
- Giovanni Resta, Table of n, a(n) for n = 0..100
Programs
-
Mathematica
s[0] = {1,2,3,5,7}; s[1] = {0,4,6,9}; s[2] = {8}; m[{sn_, t_}] := Union[Sort /@ Tuples[s[sn], {t}]]; f[nd_, nh_] := Block[{v, pa = Tally /@ IntegerPartitions[ nh, {nd}, {0, 1, 2}], bst = Infinity}, Do[v = Flatten /@ Tuples[m /@ p]; Do[z = Select[ FromDigits /@ Select[ Permutations[e], First[#] > 0 && OddQ[Last[#]] &], PrimeQ]; bst = Min[bst, {z}], {e, v}], {p, pa}]; bst]; a[0]=2; a[n_] := Block[{nd = Ceiling[(n + 1)/2], b}, While[! IntegerQ@ (b = f[nd, n]), nd++]; b]; a /@ Range[0, 30] (* Giovanni Resta, Sep 27 2019 *)
-
PARI
count_holes(n) = my(d=digits(n), i=0); for(k=1, #d, if(d[k]==0 || d[k]==4 || d[k]==6 || d[k]==9, i++, if(d[k]==8, i+=2))); i a(n) = forprime(p=1, , if(count_holes(p)==n, return(p))) \\ Felix Fröhlich, Sep 27 2019
Extensions
a(7) corrected and more terms added by Felix Fröhlich, Sep 27 2019
More terms from Giovanni Resta, Sep 27 2019
Comments