A265733 Number of n-digit primes whose digits include at least n-1 digits "1".
4, 8, 10, 9, 10, 13, 7, 16, 10, 11, 11, 13, 9, 11, 6, 7, 8, 16, 7, 11, 8, 9, 9, 10, 8, 12, 6, 13, 13, 21, 7, 12, 8, 7, 15, 16, 8, 9, 17, 9, 5, 22, 9, 15, 6, 12, 9, 20, 11, 13, 14, 11, 13, 12, 9, 15, 7, 4, 8, 12, 4, 11, 8, 15, 10, 17, 12, 12, 4, 9, 9, 14, 8, 14, 10, 7, 10, 14, 5, 14
Offset: 1
Examples
a(1) = 4 because {2, 3, 5, 7} are primes; a(2) = 8 because {11, 13, 17, 19, 31, 41, 61, 71} are two digit primes with at least one digit being 1; a(3) = 10 because {101, 113, 131, 151, 181, 191, 211, 311, 811, 911} are three digit primes with at least two digit being 1, etc.
Links
- Michael De Vlieger and Robert G. Wilson v, Table of n, a(n) for n = 1..1550
Programs
-
Maple
A:= proc(n) local x,X,i,y; x:= (10^n-1)/9; y:= [x,seq(seq(x+10^i*y,y=1..8),i=0..n-1),seq(x - 10^i,i=0..n-2)]; nops(select(isprime,y)) end proc: map(A, [$1..100]); # Robert Israel, Dec 31 2015
-
Mathematica
f1[n_] := Block[{cnt = k = 0, r = (10^n - 1)/9, s = {-1, 1, 2, 3, 4, 5, 6, 7, 8}}, If[ PrimeQ@ r, cnt++]; If[ PrimeQ[(10^(n - 1) - 1)/9], cnt--]; While[k < n, p = Select[r + 10^k*s, PrimeQ]; cnt += Length@ p; k++]; cnt]; Array[f1, 70]
Formula
Number of n-digit primes of the form 111...d...111, where the number of ones is at least n-1 and d is any other decimal digit.
Comments