login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A069710 Primes with arithmetic mean of digits = 1 (sum of digits = number of digits). 14

%I #28 Nov 28 2023 22:00:23

%S 11,1021,1201,2011,3001,10103,10211,10301,11003,12011,12101,13001,

%T 20021,20201,21011,21101,30011,1000033,1000213,1000231,1000303,

%U 1001023,1001041,1001311,1001401,1002121,1003003,1003111,1003201,1010131

%N Primes with arithmetic mean of digits = 1 (sum of digits = number of digits).

%C The sum of the digits of a prime > 3 cannot be a multiple of 3, hence no prime with 3*k digits can be here. - _David Radcliffe_, May 05 2015

%C Subsequence of primes of A061384. - _Michel Marcus_, May 05 2015

%H David Radcliffe, <a href="/A069710/b069710.txt">Table of n, a(n) for n = 1..13376</a>

%p F:= proc(d,s) option remember;

%p local t,r;

%p if d = 1 then

%p if s >= 1 and s <= 9 then {s}

%p else {}

%p fi

%p else

%p `union`(seq(map(t -> 10*t+r, procname(d-1,s-r)), r=0..min(s,9)))

%p fi

%p end proc:

%p `union`(seq(select(isprime,F(i,i)), i = remove(d -> d mod 3 = 0, [$1..8]));

%p # if using Maple 11 or earlier, uncomment the next line

%p # sort(convert(%,list)); # _Robert Israel_, May 05 2015

%t Do[p = Prime[n]; If[ Apply[ Plus, IntegerDigits[p]] == Floor[ Log[10, p] + 1], Print[p]], {n, 1, 10^5}]

%o (Python)

%o from itertools import count, islice

%o from collections import Counter

%o from sympy.utilities.iterables import partitions, multiset_permutations

%o from sympy import isprime

%o def A069710_gen(): # generator of terms

%o for l in count(1):

%o for i in range(1,min(9,l)+1):

%o yield from sorted(q for q in (int(str(i)+''.join(map(str,j))) for s,p in partitions(l-i,k=9,size=True) for j in multiset_permutations([0]*(l-1-s)+list(Counter(p).elements()))) if isprime(q))

%o A069710_list = list(islice(A069710_gen(),30)) # _Chai Wah Wu_, Nov 28 2023

%Y Cf. A069709, A069711, A069712.

%K nonn,base

%O 1,1

%A _Amarnath Murthy_, Apr 08 2002

%E Edited and extended by _Robert G. Wilson v_, Apr 12 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 03:30 EDT 2024. Contains 371782 sequences. (Running on oeis4.)