OFFSET
1,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
FORMULA
a(1)=1, a(2)=4; a(n) = 9*a(floor(n/2))+1 for n odd, otherwise a(n) = 9*a(floor((n-1)/2))+4. - Bruno Berselli, May 28 2012
MATHEMATICA
Select[Range[9600], MemberQ[{{1}, {4}, {1, 4}}, Union[IntegerDigits[ #, 9]]]&] (* Harvey P. Dale, Jul 24 2011 *)
Flatten[Table[FromDigits[#, 9]&/@Tuples[{1, 4}, n], {n, 5}]] (* Vincenzo Librandi, May 28 2012 *)
PROG
(Magma) [n: n in [1..10000] | Set(IntegerToSequence(n, 9)) subset {1, 4}]; // Vincenzo Librandi, May 28 2012
(Maxima) a[1]:1$ a[2]:4$ a[n]:= if oddp(n) then 9*a[floor(n/2)]+1 else 9*a[floor((n-1)/2)]+4$ makelist(a[n], n, 1, 42); /* Bruno Berselli, May 28 2012 */
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved