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.
%I A166747 #6 Dec 12 2015 16:51:31 %S A166747 1,11,111,1112,11122,122222,1222222,12222224,122222224,1222222244, %T A166747 12222224444,122222224444,1222222444444,12222224444444, %U A166747 122222224444444,1222222244444444,12222224444444444,122222444444444444,1222222444444444444,12222244444444444444 %N A166747 Numbers with n digits from the set {1,2,4}, requiring a nondecreasing sequence of digits and a digits sum of A008578(n). %C A166747 Or: a partitioning of p=A008578(n) into n parts, each part an element of {1,2,4}. %C A166747 The representation is often not unique: p=11 could be represented by 111224 or 122222, p=13 by 1111144 or 1112224 or 1222222, p=17 by 11111444 or 11122244 or 12222224. a(n) selects the representation with the minimum number of 4's. - _R. J. Mathar_, Oct 25 2009 %p A166747 A008578 := proc(n) if n = 1 then 1; else ithprime(n-1) ; fi; end: %p A166747 A166747 := proc(n) local p,n1,n2,n4,i ; p := A008578(n) ; for n4 from 0 to n do n2 := p-n-3*n4 ; n1 := n-n2-n4 ; if n2 >= 0 and n1 >= 0 then a := 0 ; for i from 1 to n1 do a := 10*a+1 ; od: for i from 1 to n2 do a := 10*a+2 ; od: for i from 1 to n4 do a := 10*a+4 ; od: return a ; end if: end do: end: %p A166747 seq(A166747(n),n=1..20) ; # _R. J. Mathar_, Oct 25 2009 %Y A166747 Cf. A134732. %K A166747 nonn,base %O A166747 1,2 %A A166747 _Paul Curtz_, Oct 21 2009 %E A166747 Edited by _R. J. Mathar_, Oct 25 2009