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.

A377571 a(n) is a n-digit number; for k = 1..n, its k-th digit is the most frequent k-th digit among n-digit prime numbers; in case of a tie, preference is given to the least digit.

This page as a plain text file.
%I A377571 #20 Nov 07 2024 08:46:12
%S A377571 2,13,157,1223,12127,104993,1000597,10289067,100080553,1000447633,
%T A377571 10015225131
%N A377571 a(n) is a n-digit number; for k = 1..n, its k-th digit is the most frequent k-th digit among n-digit prime numbers; in case of a tie, preference is given to the least digit.
%C A377571 Although each digit taken independently is the most likely to be in that position for a prime number, overall, a term is not necessarily a prime number; for example, a(5) = 67 * 181 is composite.
%C A377571 For n>1, a(n)'s last digit is either 1, 3, 7 or 9. The prime number theorem says that the number of primes <= n is not linear with n, but grows sparser at a rate of n/log(n) so we expect the first digit of a(n) to be equal to 1 and the k-th digit of a(n) to be 0 for k>1 fixed and as n -> oo.  - _Chai Wah Wu_, Nov 06 2024
%e A377571 For n = 4: the frequency of digits among 4-digit prime numbers, and the corresponding most frequent digits, are:
%e A377571   Digit    0     1     2     3    4    5    6    7    8    9  Most frequent
%e A377571   -----  ---  ----  ----  ----  ---  ---  ---  ---  ---  ---  -------------
%e A377571   1st      0   135*  127   120  119  114  117  107  110  112              1
%e A377571   2nd    112    95   116*  104  104  107  115  104  106   98              2
%e A377571   3rd    105   107   116*  110  103  106  104  101  105  104              2
%e A377571   4th      0   266     0   268*   0    0    0  262    0  265              3
%e A377571 - so a(4) = 1223.
%o A377571 (PARI) a(n, base = 10) = { my (f = vector(n, k, vector(base))); forprime (p = base^(n-1), base^n-1, my (d = digits(p, base)); for (k = 1, n, f[k][1+d[k]]++;);); my (b = vector(n), i); for (k = 1, n, vecmax(f[k], &i); b[k] = i-1;); fromdigits(b, base); }
%o A377571 (Python)
%o A377571 from sympy import primerange
%o A377571 def A377571(n):
%o A377571     c = [[0]*10 for i in range(n)]
%o A377571     for p in primerange(10**(n-1),10**n):
%o A377571         for i, j in enumerate(str(p)):
%o A377571             c[i][int(j)]+=1
%o A377571     return int(''.join(str(c[i].index(max(c[i]))) for i in range(n))) # _Chai Wah Wu_, Nov 06 2024
%Y A377571 Cf. A092800, A152272.
%K A377571 nonn,base,more
%O A377571 1,1
%A A377571 _Rémy Sigrist_, Nov 01 2024