cp's OEIS Frontend

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.

A254115 Permutation of natural numbers: a(n) = A254104(A048673(n)).

This page as a plain text file.
%I A254115 #13 Jun 06 2017 10:33:10
%S A254115 1,2,3,4,5,6,7,8,13,10,11,12,9,14,21,16,15,26,23,20,43,22,19,24,63,18,
%T A254115 33,28,31,42,47,32,55,30,127,52,27,46,87,40,17,86,39,44,107,38,29,48,
%U A254115 75,126,91,36,95,66,191,56,53,62,45,84,35,94,1023,64,255,110,25,60,183,254,79,104,37,54,171,92,125,174,59,80,4095,34,61,172,77,78
%N A254115 Permutation of natural numbers: a(n) = A254104(A048673(n)).
%H A254115 Antti Karttunen, <a href="/A254115/b254115.txt">Table of n, a(n) for n = 1..8192</a>
%H A254115 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A254115 a(n) = A254104(A048673(n)).
%F A254115 Other identities. For all n >= 1:
%F A254115 a(n) = a(2n)/2. [Even bisection halved gives back the sequence itself.]
%F A254115 A254117(n) = (a((2*n)+1) - 1)/2. [Likewise, the odd bisection induces A254117.]
%o A254115 (Scheme, different implementations)
%o A254115 (define (A254115 n) (A254104 (A048673 n)))
%o A254115 (definec (A254115 n) (cond ((<= n 1) n) ((even? n) (* 2 (A254115 (/ n 2)))) (else (+ 1 (* 2 (A254104 (Ainv_of_A007310off0 (A003961 n))))))))
%o A254115 (define (Ainv_of_A007310off0 n) (+ (* 2 (floor->exact (/ n 6))) (/ (- (modulo n 6) 1) 4)))
%o A254115 (Python)
%o A254115 from sympy import factorint, nextprime
%o A254115 from operator import mul
%o A254115 def a048673(n):
%o A254115     f = factorint(n)
%o A254115     return 1 if n==1 else (1 + reduce(mul, [nextprime(i)**f[i] for i in f]))/2
%o A254115 def a254104(n):
%o A254115     if n==0: return 0
%o A254115     if n%3==0: return 1 + 2*a254104(2*n/3 - 1)
%o A254115     elif n%3==1: return 1 + 2*a254104(2*(n - 1)/3)
%o A254115     else: return 2*a254104((n - 2)/3 + 1)
%o A254115 def a(n): return a254104(a048673(n)) # _Indranil Ghosh_, Jun 06 2017
%Y A254115 Inverse: A254116.
%Y A254115 Fixed points: A254099.
%Y A254115 Related permutations: A048673, A254104, A254117.
%Y A254115 Cf. A003961, A007310.
%K A254115 nonn
%O A254115 1,2
%A A254115 _Antti Karttunen_, Feb 04 2015