login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Permutation of natural numbers: a(1) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(1+n)) = 1 + 2*a(n).
4

%I #15 Jun 12 2020 07:10:35

%S 1,2,4,3,8,6,16,9,5,12,32,17,18,10,24,33,64,65,34,11,36,20,48,129,7,

%T 66,19,37,128,130,68,49,22,72,40,97,96,258,14,69,132,38,74,73,21,256,

%U 260,81,13,29,136,15,98,521,44,39,144,80,194,257,192,516,23,137,28,138,264,45,76,148,146,197,42,512,147,193,520,162,26,27

%N Permutation of natural numbers: a(1) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(1+n)) = 1 + 2*a(n).

%H Antti Karttunen, <a href="/A284571/b284571.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(1) = 1, for n > 1, if A008683(n) <> 0 [when n is squarefree], a(n) = 2*a(A013928(n)), otherwise a(n) = 1 + 2*a(A285328(n)-1).

%o (Scheme, with memoization-macro definec)

%o (definec (A284571 n) (cond ((= 1 n) n) ((not (zero? (A008683 n))) (* 2 (A284571 (A013928 n)))) (else (+ 1 (* 2 (A284571 (+ -1 (A285328 n))))))))

%o (Python)

%o from operator import mul

%o from sympy import primefactors

%o from sympy.ntheory.factor_ import core

%o def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))

%o def a285328(n):

%o if core(n) == n: return 1

%o k=n - 1

%o while k>0:

%o if a007947(k) == a007947(n): return k

%o else: k-=1

%o def a013928(n): return sum(1 for i in range(1, n) if core(i) == i)

%o def a(n):

%o if n==1: return 1

%o if core(n)==n: return 2*a(a013928(n))

%o else: return 1 + 2*a(a285328(n) - 1)

%o [a(n) for n in range(1, 121)] # _Indranil Ghosh_, Apr 17 2017

%Y Inverse: A284572.

%Y Cf. A005117, A008683, A013928, A065642, A285328.

%Y Similar or related permutations: A243343, A243345, A277695, A285111.

%K nonn

%O 1,2

%A _Antti Karttunen_, Apr 17 2017