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.
%I A258915 #35 Jul 02 2025 18:09:41 %S A258915 0,0,46,43,40,53,35,49,40,38,44,52,35,45,49,42,38,57,27,45,38,47,37, %T A258915 52,33,45,56,38,36,65,29,56,48,40,38,58,37,33,57,40,37,61,41,39,37,44, %U A258915 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 %N A258915 The number of n-digit near-repdigit primes (A164937). %C A258915 The average is 44.25 with a standard deviation of about 9.48 for the first 1000 terms. %C A258915 First occurrence of 20 < k < 80: 1132, ??22??, 1304, 433, 141, 181, 19, 118, 31, 253, 357, 137, 25, 68, 7, 29, 23, 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, ??73??, 66, ??75??, 816, 264, ??78??, 298; where ??xx?? denotes an unknown value for the index xx. %C A258915 Roughly speaking, the probability that a random n-digit number is prime is about 1/(n*log(10)). The number of near-repdigit n-digit numbers is 81*n. Therefore it would be reasonable to expect around 81/log(10) (about 35) primes for each n. - _Giovanni Resta_, Jun 19 2015 %H A258915 Robert G. Wilson v, <a href="/A258915/b258915.txt">Table of n, a(n) for n = 1..1532</a> %e A258915 a(1) & a(2) = 0 by definition. %e A258915 a(3) = 46 since there are 46 terms of 3 digits, see A164937(1) - A164937(46). %t A258915 f[n_] := Block[{lst = {}, r = (10^(n - 1) - 1)/9}, Do[ AppendTo[ lst, DeleteCases[ Select[ FromDigits[ Permutations[ Append[ IntegerDigits[ a*r], d]]], PrimeQ@# && # > 100 &], r]], {a, 9}, {d, 0, 9}]; Length@ Union@ Flatten@ lst](* adapted after _Arkadiusz Wesolowski_ of A164937 *) Array[f, 70] %t A258915 (* to view the terms assign the terms in the b-file to "lst" and then *) ListPlot@ Sort@ lst (* and/or *) g[n_] := Count[lst, n]; DiscretePlot[ g[n], {n, 23, 80}] %o A258915 (Python) %o A258915 from gmpy2 import is_prime, digits %o A258915 def a(n): %o A258915 if n < 3: return 0 %o A258915 Rn = (10**n-1)//9 %o A258915 return len(set(t for d in range(1, 10) for i in range(n if d in {1, 3, 7, 9} else 1) for c in set(range(-d, 10-d))-{0} if len(digits(t:=d*Rn+c*10**i))==n and is_prime(t))) %o A258915 print([a(n) for n in range(1, 73)]) # _Michael S. Branicky_, Jun 28 2025 %Y A258915 Cf. A164937. %Y A258915 Essentially the same as A385280 but excluding near-repunit primes of A004022. %K A258915 nonn %O A258915 1,3 %A A258915 _Robert G. Wilson v_, Jun 14 2015