The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A266411 a(1) = 1, after which each a(n) = (A004074(n)+1)-th number selected from those not yet in the sequence. 5

%I #9 Jan 02 2016 04:14:43

%S 1,2,4,3,6,8,7,5,10,12,14,13,16,15,11,9,18,20,22,24,23,26,28,27,30,29,

%T 25,32,31,21,19,17,34,36,38,40,42,41,44,46,48,47,50,52,51,54,53,49,56,

%U 58,57,60,59,55,62,61,45,43,64,63,39,37,35,33,66,68,70,72,74,76,75,78,80,82,84,83,86,88,90,89,92,94,93,96,95,91

%N a(1) = 1, after which each a(n) = (A004074(n)+1)-th number selected from those not yet in the sequence.

%H Antti Karttunen, <a href="/A266411/b266411.txt">Table of n, a(n) for n = 1..8192</a>

%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%t f[n_] := Block[{a = {1}, g, b = Range[2, n]}, g[1] = g[2] = 1; g[x_] := g[x] = g[g[x - 1]] + g[x - g[x - 1]]; Do[{AppendTo[a, #[[1, 1]]], Set[b, Last@ #]} &@ If[# > Length@ b, Break[], TakeDrop[b, {#}]] &@ (2 g[#] - # + 1) &@ k, {k, 2, n}]; a]; f@ 97 (* _Michael De Vlieger_, Dec 29 2015, Version 10.2, based on _Harvey P. Dale_ at A004074 *)

%o (Scheme, with defineperm1-macro from Antti Karttunen's IntSeq-library)

%o (defineperm1 (A266411 n) (if (<= n 1) n (let loop ((i 1) (the-nth-one (A004074 n))) (cond ((not-lte? (A266412 i) n) (if (zero? the-nth-one) i (loop (+ i 1) (- the-nth-one 1)))) (else (loop (+ i 1) the-nth-one))))))

%o (define (A266412 n) (A266411 (- n))) ;; This returns inverse values of A266411 from its hidden cache that defineperm1-macro has prepared. #f is returned for those n that have not yet been encountered.

%o ;; We consider a > b (i.e. not less than b) also in case a is #f.

%o ;; (Because of the stateful caching system used by defineperm1-macro):

%o (define (not-lte? a b) (cond ((not (number? a)) #t) (else (> a b))))

%Y Inverse: A266412.

%Y Cf. A004074.

%Y Similar permutations in Quetian style: A119435, A126917, A246165, A266413.

%Y Cf. also A265901, A265903.

%K nonn

%O 1,2

%A _Antti Karttunen_, Dec 29 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 16 19:52 EDT 2024. Contains 373432 sequences. (Running on oeis4.)