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.

A306520 Numbers k with property that the arithmetic mean of any subset of its digits is an integer.

Original entry on oeis.org

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, 42, 44, 46, 48, 51, 53, 55, 57, 59, 60, 62, 64, 66, 68, 71, 73, 75, 77, 79, 80, 82, 84, 86, 88, 91, 93, 95, 97, 99, 111, 117, 135, 153, 159, 171, 177, 195
Offset: 1

Views

Author

R. J. Cano, Feb 21 2019

Keywords

Comments

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.

Examples

			17 is in this sequence because the set of digits (1,7) has an integer average: 4.
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.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0,200],AllTrue[Mean/@Subsets[IntegerDigits[#],{2, IntegerLength[ #]}],IntegerQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 09 2020 *)
  • 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))))}
    
  • 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}

Formula

Apparently a(158+n) = A010785(35+n).