This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A284571 #15 Jun 12 2020 07:10:35 %S A284571 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 A284571 66,19,37,128,130,68,49,22,72,40,97,96,258,14,69,132,38,74,73,21,256, %U A284571 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 A284571 Permutation of natural numbers: a(1) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(1+n)) = 1 + 2*a(n). %H A284571 Antti Karttunen, <a href="/A284571/b284571.txt">Table of n, a(n) for n = 1..10000</a> %H A284571 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A284571 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 A284571 (Scheme, with memoization-macro definec) %o A284571 (definec (A284571 n) (cond ((= 1 n) n) ((not (zero? (A008683 n))) (* 2 (A284571 (A013928 n)))) (else (+ 1 (* 2 (A284571 (+ -1 (A285328 n)))))))) %o A284571 (Python) %o A284571 from operator import mul %o A284571 from sympy import primefactors %o A284571 from sympy.ntheory.factor_ import core %o A284571 def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n)) %o A284571 def a285328(n): %o A284571 if core(n) == n: return 1 %o A284571 k=n - 1 %o A284571 while k>0: %o A284571 if a007947(k) == a007947(n): return k %o A284571 else: k-=1 %o A284571 def a013928(n): return sum(1 for i in range(1, n) if core(i) == i) %o A284571 def a(n): %o A284571 if n==1: return 1 %o A284571 if core(n)==n: return 2*a(a013928(n)) %o A284571 else: return 1 + 2*a(a285328(n) - 1) %o A284571 [a(n) for n in range(1, 121)] # _Indranil Ghosh_, Apr 17 2017 %Y A284571 Inverse: A284572. %Y A284571 Cf. A005117, A008683, A013928, A065642, A285328. %Y A284571 Similar or related permutations: A243343, A243345, A277695, A285111. %K A284571 nonn %O A284571 1,2 %A A284571 _Antti Karttunen_, Apr 17 2017