cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A266149 Number of n-digit primes that consist of at least n-1 copies of some decimal digit.

This page as a plain text file.
%I A266149 #21 Apr 22 2021 03:44:13
%S A266149 4,21,46,43,40,53,35,49,40,38,44,52,35,45,49,42,38,57,28,45,38,47,38,
%T A266149 52,33,45,56,38,36,65,29,56,48,40,38,58,37,33,57,40,37,61,41,39,37,44,
%U A266149 36,55,47,43,47,43,35,62,43,46,29,35,37,56,39,41,46,48,39,74,45,34,34,35,34,67,39,45,43
%N A266149 Number of n-digit primes that consist of at least n-1 copies of some decimal digit.
%C A266149 The first n at which a(n)=k for k=1...80, or 0 if no such k exists with n < 701: 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 433, 141, 181, 847, 19, 31, 253, 357, 137, 25, 68, 7, 29, 37, 10, 44, 5, 43, 16, 4, 11, 14, 3, 22, 33, 8, 139, 82, 12, 6, 102, 48, 27, 18, 36, 270, 198, 42, 54, 498, 90, 30, 738, 72, 222, 192, 852, 84, 342, 0, 66, 0, 816, 264, 0, 288, 0.
%H A266149 Michael De Vlieger and Robert G. Wilson v, <a href="/A266149/b266149.txt">Table of n, a(n) for n = 1..1215</a>
%F A266149 a(n) = A265733(n) + A266141(n) + A266142(n) + A266143(n) + A266144(n) + A266145(n) + A266146(n) + A266147(n) + A266148(n) for n>2.
%e A266149 a(1) = 4 since 2, 3, 5 and 7 are primes,
%e A266149 a(2) = 21 since 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97 are primes,
%e A266149 a(3) = 46 since 101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, 449, 499, 557, 577, 599, 661, 677, 727, 733, 757, 773, 787, 797, 811, 877, 881, 883, 887, 911, 919, 929, 977, 991, 997 are all primes,
%e A266149 a(4) = 43 since 1117, 1151, 1171, 1181, 1511, 1777, 1811, 1999, 2111, 2221, 2333, 2777, 2999, 3313, 3323, 3331, 3343, 3373, 3433, 3533, 3733, 3833, 4111, 4441, 4447, 4999, 5333, 5557, 6661, 7177, 7333, 7477, 7577, 7717, 7727, 7757, 7877, 8111, 8887, 8999, 9199, 9929 and 9949 are primes; etc.
%t A266149 Length /@ Array[Function[n, Select[Union[Flatten[Function[k, Select[FromDigits /@ Flatten[Permutations[Flatten@ {Table[k, {n - 1}], #}] & /@ Range[0, 9], 1], PrimeQ]] /@ Range[1, 9]]], Function[m, IntegerLength@ m == n]]], 100] (* _Michael De Vlieger_, Jan 01 2016 *)
%o A266149 (Python)
%o A266149 from sympy import isprime
%o A266149 def a(n):
%o A266149   if n == 1: return 4
%o A266149   okset = set()
%o A266149   for digit1 in "24568":
%o A266149     for digit2 in "1379":
%o A266149       t = int(digit1*(n-1) + digit2)
%o A266149       if isprime(t): okset.add(t)
%o A266149   for digit1 in "1379":
%o A266149     for digit2 in "0123456789":
%o A266149       if ((n-1)*int(digit1) + int(digit2))%3 == 0: continue
%o A266149       for j in range(n):
%o A266149         mc = digit1*j + digit2 + digit1*(n-1-j)
%o A266149         if mc[0] == '0': continue
%o A266149         t = int(mc)
%o A266149         if isprime(t): okset.add(t)
%o A266149   return len(okset)
%o A266149 print([a(n) for n in range(1, 76)]) # _Michael S. Branicky_, Apr 21 2021
%Y A266149 Cf. A265733, A266141, A266142, A266143, A266144, A266145, A266146, A266147, A266148.
%K A266149 base,nonn
%O A266149 1,1
%A A266149 _Michael De Vlieger_ and _Robert G. Wilson v_, Dec 21 2015