# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a306520 Showing 1-1 of 1 %I A306520 #24 Jul 23 2023 01:54:03 %S A306520 0,1,2,3,4,5,6,7,8,9,11,13,15,17,19,20,22,24,26,28,31,33,35,37,39,40, %T A306520 42,44,46,48,51,53,55,57,59,60,62,64,66,68,71,73,75,77,79,80,82,84,86, %U A306520 88,91,93,95,97,99,111,117,135,153,159,171,177,195 %N A306520 Numbers k with property that the arithmetic mean of any subset of its digits is an integer. %C A306520 This sequence is different from A061383. Here digits in k must have all the same parity, otherwise the average of at least a pair of digits wouldn't be an integer. Note that for every 2-digit term in A061383 both digits have the same parity. But not every number whose digits have all the same parity (sequence A059708) belongs here. %H A306520 Harvey P. Dale, Table of n, a(n) for n = 1..177 (all terms up to 1 million) %F A306520 Apparently a(158+n) = A010785(35+n). %e A306520 17 is in this sequence because the set of digits (1,7) has an integer average: 4. %e A306520 159 and 195 are in this sequence because the sets of digits (1,5), (1,9), (5,9), and (1,5,9) all have integer averages, respectively: 3, 5, 7, and 5. %t A306520 Select[Range[0,200],AllTrue[Mean/@Subsets[IntegerDigits[#],{2, IntegerLength[ #]}],IntegerQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Aug 09 2020 *) %o A306520 (PARI) firstTerms_vec(n)={my(v=vector(n),c,t,w:list,h);for(i=1,+oo,w=List();forsubset(i,k,listput(w,k));listpop(w,1);forvec(j=vector(i,z,[(z==1)&&(i>1),9]),h=j[1]%2;for(l=2,#j,if((j[l]%2)!=h,next(2)));for(k=1,#w,t=vecextract(j,w[k]);if(vecsum(t)%(#w[k]),next(2)));v[c++]=fromdigits(j);if(c==n,return(v))))} %o A306520 (PARI) isok(m,{B=10})={my(w=digits(m,B));forsubset(#w,y,if(y!=Vecsmall([]),if(vecsum(vecextract(w,y))%(#y),return(0)),next));1} %Y A306520 Cf. A061383, A059708, A010785, A165165. %K A306520 nonn,base %O A306520 1,3 %A A306520 _R. J. Cano_, Feb 21 2019 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE