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 5 for every i.
The first 2^n terms of the sequence could be obtained using the Cantor-like process for the segment [0,5^n-1]. For example, for n=1 we have [0, {1,2,3},4] such that numbers outside of braces are the first 2 terms of the sequence; for n=2 we have [0, {1,2,3}, 4, {5,...,19}, 20, {21,22,23}, 24] such that the numbers outside of braces are the first 4 terms of the sequence, etc. - Vladimir Shevelev, Dec 17 2012
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = 4*A033042(n).
a(2n) = 5*a(n), a(2n+1) = a(2n)+4.
MATHEMATICA
fQ[n_]:=Union@Join[{0, 4}, IntegerDigits[n, 5]]=={0, 4}; Select[Range[0, 20000], fQ] (* Vincenzo Librandi, May 25 2012 *)
FromDigits[#, 5]&/@Tuples[{0, 4}, 6] (* Harvey P. Dale, Feb 01 2015 *)
PROG
(Magma) [n: n in [0..20000] | Set(IntegerToSequence(n, 5)) subset {0, 4}]; // Vincenzo Librandi, May 25 2012
(Maxima) a[0]:0$ a[n]:=5*a[floor(n/2)]+2*(1-(-1)^n)$ makelist(a[n], n, 0, 42); /* Bruno Berselli, May 25 2012 */
(PARI) a(n) = 4*fromdigits(binary(n), 5); \\ Kevin Ryde, Jun 03 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ray Chandler, Aug 03 2004
STATUS
approved