login
A269853
Permutation of natural numbers: a(1) = 1, a(2n) = 2*a(n), a(2n+1) = 1 + 2*a(A064216(n)).
2
1, 2, 3, 4, 5, 6, 7, 8, 11, 10, 9, 12, 15, 14, 19, 16, 13, 22, 31, 20, 27, 18, 21, 24, 63, 30, 23, 28, 17, 38, 43, 32, 35, 26, 29, 44, 39, 62, 87, 40, 37, 54, 79, 36, 75, 42, 25, 48, 159, 126, 127, 60, 61, 46, 51, 56, 55, 34, 53, 76, 123, 86, 107, 64, 41, 70, 71, 52, 247, 58, 125, 88, 143, 78, 251, 124, 45, 174, 59, 80, 287, 74, 33
OFFSET
1,2
FORMULA
a(1) = 1, after which for even n, a(n) = 2*a(n/2), for odd n, a(n) = 1 + 2*a(A064989(n-2)).
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[EvenQ@ n, 2 a[n/2], 1 + 2 a[Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[(n - 1) - 1]]]; Table[a@ n, {n, 83}] (* Michael De Vlieger, Mar 23 2016 *)
PROG
(Scheme, with memoization-macro definec)
(definec (A269853 n) (cond ((= 1 n) n) ((even? n) (* 2 (A269853 (/ n 2)))) (else (+ 1 (* 2 (A269853 (A064216 (/ (- n 1) 2))))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Mar 16 2016
STATUS
approved