login
A254117
Permutation of natural numbers: a(n) = A254104(A249746(1+n)-1).
3
1, 2, 3, 6, 5, 4, 10, 7, 11, 21, 9, 31, 16, 15, 23, 27, 63, 13, 43, 8, 19, 53, 14, 37, 45, 47, 95, 26, 22, 17, 511, 127, 12, 91, 39, 18, 85, 62, 29, 2047, 30, 38, 111, 20, 54, 75, 42, 55, 157, 35, 46, 174, 25, 79, 24, 59, 77, 303, 123, 94, 78, 167, 87, 223, 61, 103, 699, 191, 41, 107, 183, 125, 431, 28, 71, 84, 60, 93, 110, 767, 51
OFFSET
1,2
FORMULA
a(n) = A254104(A249746(1+n)-1).
a(n) = (A254115((2*n)+1)-1) / 2. [Obtained also from the odd bisection of A254115.]
PROG
(Scheme, two versions)
(define (A254117 n) (A254104 (+ -1 (A249746 (+ 1 n)))))
(define (A254117 n) (/ (+ -1 (A254115 (+ 1 n n))) 2))
(Python)
from sympy import factorint, nextprime
from operator import mul
def a048673(n):
f = factorint(n)
return 1 if n==1 else (1 + reduce(mul, [nextprime(i)**f[i] for i in f]))/2
def a254104(n):
if n==0: return 0
if n%3==0: return 1 + 2*a254104(2*n/3 - 1)
elif n%3==1: return 1 + 2*a254104(2*(n - 1)/3)
else: return 2*a254104((n - 2)/3 + 1)
def a254115(n): return a254104(a048673(n))
def a(n): return (a254115(2*n + 1) - 1)/2 # Indranil Ghosh, Jun 06 2017
CROSSREFS
Inverse: A254118.
Other related permutations: A249746, A254104, A254115.
Sequence in context: A106452 A254118 A056895 * A370629 A218890 A269373
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 05 2015
STATUS
approved