login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Permutation of nonnegative integers: a(1) = 0, a(2) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(n)) = 1 + 2*a(n).
5

%I #14 Apr 30 2021 12:39:38

%S 0,1,2,3,4,6,8,7,5,12,16,13,14,10,24,15,32,27,26,25,28,20,48,55,9,30,

%T 11,21,64,54,52,31,50,56,40,111,96,110,18,51,60,22,42,41,49,128,108,

%U 223,17,103,104,61,62,447,100,43,112,80,222,109,192,220,57,63,36,102,120,113,44,84,82,895,98,256,99,221,216,446,34,207,23

%N Permutation of nonnegative integers: a(1) = 0, a(2) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(n)) = 1 + 2*a(n).

%C Note the indexing: the domain starts from 1, while the range includes also zero.

%H Antti Karttunen, <a href="/A285111/b285111.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) = 0, a(2) = 1, and for n > 2, if A008683(n) <> 0 [when n is squarefree], a(n) = 2*a(A013928(n)), otherwise a(n) = 1 + 2*a(A285328(n)).

%o (Scheme, with memoization-macro definec)

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

%o (Python)

%o from operator import mul

%o from sympy import primefactors

%o from sympy.ntheory.factor_ import core

%o from functools import reduce

%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<3: return n - 1

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

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

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

%Y Inverse: A285112.

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

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

%K nonn

%O 1,3

%A _Antti Karttunen_, Apr 17 2017