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.

A266413 a(1) = 1, after which each a(n) = A002487(n)-th number selected from those not yet in the sequence.

This page as a plain text file.
%I A266413 #8 Jan 02 2016 04:15:00
%S A266413 1,2,4,3,7,6,9,5,12,11,15,10,17,14,18,8,21,20,25,19,28,24,29,16,31,27,
%T A266413 34,23,35,30,33,13,38,37,43,36,47,42,48,32,51,46,55,41,56,49,53,26,57,
%U A266413 52,62,45,65,59,64,40,66,60,69,50,68,58,63,22,71,70,77,67,82,76,83,61,87,81,92,75,93,84,89,54,94,88,101,80
%N A266413 a(1) = 1, after which each a(n) = A002487(n)-th number selected from those not yet in the sequence.
%H A266413 Antti Karttunen, <a href="/A266413/b266413.txt">Table of n, a(n) for n = 1..16385</a>
%H A266413 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A266413 f[n_] := Block[{a = {1}, g, b = Range[2, n]}, g[1] = 1; g[x_] := g[x] = If[EvenQ@ x, g[x/2], g[(x - 1)/2] + g[(x + 1)/2]]; Do[{AppendTo[a, #[[1, 1]]], Set[b, Last@ #]} &@ If[# > Length@ b, Break[], TakeDrop[b, {#}]] &@ g@ k, {k, 2, n}]; a]; f@ 103 (* _Michael De Vlieger_, Dec 29 2015, Version 10.2, after _N. J. A. Sloane_ at A002487 *)
%o A266413 (Scheme, with defineperm1-macro from Antti Karttunen's IntSeq-library)
%o A266413 (defineperm1 (A266413 n) (if (<= n 1) n (let loop ((i 1) (the-nth-one (+ -1 (A002487 n)))) (cond ((not-lte? (A266414 i) n) (if (zero? the-nth-one) i (loop (+ i 1) (- the-nth-one 1)))) (else (loop (+ i 1) the-nth-one))))))
%o A266413 (define (A266414 n) (A266413 (- n))) ;; This returns inverse values of A266413 from its hidden cache that defineperm1-macro has prepared. #f is returned for those n that have not yet been encountered.
%o A266413 ;; We consider a > b (i.e. not less than b) also in case a is #f.
%o A266413 ;; (Because of the stateful caching system used by defineperm1-macro):
%o A266413 (define (not-lte? a b) (cond ((not (number? a)) #t) (else (> a b))))
%Y A266413 Inverse: A266414.
%Y A266413 Cf. A002487.
%Y A266413 Similar permutations in Quetian style: A119435, A126917, A246165, A266411.
%Y A266413 Cf. also A266405.
%K A266413 nonn
%O A266413 1,2
%A A266413 _Antti Karttunen_, Dec 29 2015