A285228 Primes with integer arithmetic mean of digits = 8 in base 10.
79, 97, 6899, 8699, 8969, 9689, 9887, 49999, 68899, 69997, 77899, 78889, 78979, 79699, 79987, 85999, 88789, 88897, 88969, 89599, 89689, 89779, 89797, 89959, 89977, 94999, 95989, 96799, 96979, 96997, 97789, 97879, 97987, 98689, 98779, 98869, 98887, 99679, 99787
Offset: 1
Links
- Jaroslav Krizek, Table of n, a(n) for n = 1..1000
Crossrefs
Programs
-
Magma
[n: n in [1..100000] | IsPrime(n) and &+Intseq(n) mod #Intseq(n) eq 0 and &+Intseq(n) / #Intseq(n) eq 8];
-
Mathematica
Select[Prime@ Range@ PrimePi[10^5], Mean@ IntegerDigits@ # == 8 &] (* Michael De Vlieger, Apr 22 2017 *)
-
Python
from itertools import count, islice from collections import Counter from sympy.utilities.iterables import partitions, multiset_permutations def A285228_gen(): # generator of terms for l in count(2): for i in range(1,10): yield from sorted(q for q in (int(str(i)+''.join(map(str,j))) for s,p in partitions((l<<3)-i,m=l-1,k=9,size=True) for j in multiset_permutations([0]*(l-1-s)+list(Counter(p).elements()))) if isprime(q)) A285228_list = list(islice(A285228_gen(),30)) # Chai Wah Wu, Nov 28 2023