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”).

A284571
Permutation of natural numbers: a(1) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(1+n)) = 1 + 2*a(n).
4
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, 66, 19, 37, 128, 130, 68, 49, 22, 72, 40, 97, 96, 258, 14, 69, 132, 38, 74, 73, 21, 256, 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
OFFSET
1,2
FORMULA
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).
PROG
(Scheme, with memoization-macro definec)
(definec (A284571 n) (cond ((= 1 n) n) ((not (zero? (A008683 n))) (* 2 (A284571 (A013928 n)))) (else (+ 1 (* 2 (A284571 (+ -1 (A285328 n))))))))
(Python)
from operator import mul
from sympy import primefactors
from sympy.ntheory.factor_ import core
def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
def a285328(n):
if core(n) == n: return 1
k=n - 1
while k>0:
if a007947(k) == a007947(n): return k
else: k-=1
def a013928(n): return sum(1 for i in range(1, n) if core(i) == i)
def a(n):
if n==1: return 1
if core(n)==n: return 2*a(a013928(n))
else: return 1 + 2*a(a285328(n) - 1)
[a(n) for n in range(1, 121)] # Indranil Ghosh, Apr 17 2017
CROSSREFS
Inverse: A284572.
Similar or related permutations: A243343, A243345, A277695, A285111.
Sequence in context: A243052 A153212 A244981 * A124833 A181815 A324931
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 17 2017
STATUS
approved