login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Number of n-digit primes in which n-1 of the digits are 4's.
9

%I #24 Feb 26 2024 19:20:30

%S 4,3,2,2,1,2,0,0,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,0,

%T 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0

%N Number of n-digit primes in which n-1 of the digits are 4's.

%C The leading digits must be 4's and only the trailing digit can vary.

%C For n large a(n) is usually zero.

%H Michael De Vlieger and Robert G. Wilson v, <a href="/A266143/b266143.txt">Table of n, a(n) for n = 1..1500</a>

%e a(3) = 2 since 443 and 449 are primes.

%e a(4) = 2 since 4441 and 4447 are primes.

%t d = 4; Array[Length@ Select[d (10^# - 1)/9 + (Range[0, 9] - d), PrimeQ] &, 100]

%o (Python)

%o from __future__ import division

%o from sympy import isprime

%o def A266143(n):

%o return 4 if n==1 else sum(1 for d in [-3,-1,3,5] if isprime(4*(10**n-1)//9+d)) # _Chai Wah Wu_, Dec 27 2015

%Y Cf. A265733, A266141, A266142, A266144, A266145, A266146, A266147, A266148, A266149, A099412, A096845, A099413, A099414.

%K nonn,base

%O 1,1

%A _Michael De Vlieger_ and _Robert G. Wilson v_, Dec 21 2015