%I #12 Nov 28 2023 16:30:04
%S 79,97,6899,8699,8969,9689,9887,49999,68899,69997,77899,78889,78979,
%T 79699,79987,85999,88789,88897,88969,89599,89689,89779,89797,89959,
%U 89977,94999,95989,96799,96979,96997,97789,97879,97987,98689,98779,98869,98887,99679,99787
%N Primes with integer arithmetic mean of digits = 8 in base 10.
%H Jaroslav Krizek, <a href="/A285228/b285228.txt">Table of n, a(n) for n = 1..1000</a>
%t Select[Prime@ Range@ PrimePi[10^5], Mean@ IntegerDigits@ # == 8 &] (* _Michael De Vlieger_, Apr 22 2017 *)
%o (Magma) [n: n in [1..100000] | IsPrime(n) and &+Intseq(n) mod #Intseq(n) eq 0 and &+Intseq(n) / #Intseq(n) eq 8]
%o (Python)
%o from itertools import count, islice
%o from collections import Counter
%o from sympy.utilities.iterables import partitions, multiset_permutations
%o def A285228_gen(): # generator of terms
%o for l in count(2):
%o for i in range(1,10):
%o 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))
%o A285228_list = list(islice(A285228_gen(),30)) # _Chai Wah Wu_, Nov 28 2023
%Y Primes from A061425. Subsequence of A069709.
%Y Sequences of primes such that a(n) = k for k = 1, 2, 4, 5, 7 and 8: A069710 (k = 1), A285096 (k = 2), A285225 (k = 4), A285226 (k = 5), A285227 (k = 7), this sequence (k = 8).
%K nonn,base
%O 1,1
%A _Jaroslav Krizek_, Apr 19 2017
|