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.

A269854 Permutation of natural numbers: a(1) = 1, a(2n) = 2*a(n), a(2n+1) = 2+A003961(a(n)).

This page as a plain text file.
%I A269854 #11 Mar 25 2016 07:47:16
%S A269854 1,2,3,4,5,6,7,8,11,10,9,12,17,14,13,16,29,22,15,20,23,18,27,24,47,34,
%T A269854 21,28,35,26,19,32,83,58,33,44,41,30,37,40,65,46,31,36,77,54,127,48,
%U A269854 137,94,55,68,59,42,57,56,101,70,79,52,53,38,25,64,245,166,91,116,95,66,67,88,119,82,45,60,107,74,43,80,191,130,121,92,89,62,39
%N A269854 Permutation of natural numbers: a(1) = 1, a(2n) = 2*a(n), a(2n+1) = 2+A003961(a(n)).
%C A269854 This sequence can be represented as a binary tree. When the parent contains n, the left hand child contains 2n, while the contents of the right hand child is obtained as 2+A003961(n):
%C A269854                                     1
%C A269854                                     |
%C A269854                  ................../ \..................
%C A269854                 2                                       3
%C A269854       4......../ \........5                   6......../ \........7
%C A269854      / \                 / \                 / \                 / \
%C A269854     /   \               /   \               /   \               /   \
%C A269854    /     \             /     \             /     \             /     \
%C A269854   8       11         10       9          12       17         14       13
%C A269854 16 29   22  15     20  23   18 27      24  47   34  21     28  35   26  19
%C A269854 etc.
%H A269854 Antti Karttunen, <a href="/A269854/b269854.txt">Table of n, a(n) for n = 1..8192</a>
%H A269854 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A269854 a(1) = 1, a(2n) = 2*a(n), a(2n+1) = 2+A003961(a(n)) = 1 + 2*A048673(a(n)).
%o A269854 (PARI)
%o A269854 default(primelimit, (2^31)+(2^30));
%o A269854 A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of _Michel Marcus_
%o A269854 A269854(n) = if(1==n, 1, if(!(n%2), 2*A269854(n/2), 2+A003961(A269854((n-1)/2))));
%o A269854 for(n=1, 8192, write("b269854.txt", n, " ", A269854(n)));
%o A269854 (Scheme, with memoization-macro definec)
%o A269854 (definec (A269854 n) (cond ((= 1 n) n) ((even? n) (* 2 (A269854 (/ n 2)))) (else (+ 1 (A243501 (A269854 (/ (- n 1) 2)))))))
%Y A269854 Inverse: A269853.
%Y A269854 Cf. A003961, A048673, A163511, A243501, A246375, A269865.
%K A269854 nonn,tabf
%O A269854 1,2
%A A269854 _Antti Karttunen_, Mar 16 2016