OFFSET
0,2
COMMENTS
n such that there exists a permutation p_1, ..., p_n of 1, ..., n such that i + p_i is a power of 9 for every i.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = 8*A033046(n).
a(2n) = 9*a(n), a(2n+1) = a(2n)+8.
MATHEMATICA
fQ[n_]:=Union@Join[{0, 8}, IntegerDigits[n, 9]]=={0, 8}; Select[Range[0, 500000], fQ] (* or *) FromDigits[#, 9]&/@Tuples[{0, 8}, 6](* Vincenzo Librandi, May 25 2012 *)
PROG
(Magma) [n: n in [0..500000] | Set(IntegerToSequence(n, 9)) subset {0, 8}]; // Vincenzo Librandi, May 25 2012
(Maxima) a[0]:0$ a[n]:=9*a[floor(n/2)]+4*(1-(-1)^n)$ makelist(a[n], n, 0, 36); /* Bruno Berselli, May 26 2012 */
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ray Chandler, Aug 03 2004
STATUS
approved