login
A257690
Permutation of natural numbers: a(1) = 1, a(lucky(n)) = (2*a(n))-1, a(unlucky(n)) = 2*n, where lucky(n) = n-th lucky number A000959, unlucky(n) = n-th unlucky number A050505.
5
1, 2, 3, 4, 6, 8, 5, 12, 7, 16, 10, 24, 11, 14, 15, 32, 20, 48, 22, 28, 9, 30, 64, 40, 23, 96, 44, 56, 18, 60, 13, 128, 31, 80, 46, 192, 19, 88, 112, 36, 120, 26, 47, 256, 62, 160, 92, 384, 21, 38, 27, 176, 224, 72, 240, 52, 94, 512, 124, 320, 184, 768, 29, 42, 76, 54, 63, 352, 39, 448, 144, 480, 95, 104, 43, 188, 1024, 248, 55
OFFSET
1,2
FORMULA
a(1) = 1; for n > 1: if A145649(n) = 1 [i.e., if n is lucky], then a(n) = (2*a(A109497(n)))-1, otherwise a(n) = 2*a(n-A109497(n)). [Where A109497(n) gives the number of lucky numbers <= n.]
PROG
(Scheme, with memoizing definec-macro)
(definec (A257690 n) (cond ((= 1 n) n) ((= 1 (A145649 n)) (+ -1 (* 2 (A257690 (A109497 n))))) (else (* 2 (A257690 (- n (A109497 n)))))))
CROSSREFS
Inverse permutation: A183089.
Cf. also A257725 (similar permutation with a slightly different definition, resulting the first differing term at n=13, where a(13) = 11, while A257725(13) = 9).
Cf. also A257735 - A257738.
Sequence in context: A038150 A182831 A257725 * A336322 A277519 A277623
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 09 2015
STATUS
approved