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.

A268182 A solution to a(n+1) in {a(n)+2, a(n)-2, a(n)*2, a(n)/2} which is a rearrangement of the natural numbers.

This page as a plain text file.
%I A268182 #17 Dec 02 2016 20:05:46
%S A268182 2,1,3,6,4,8,10,5,7,9,11,22,20,18,16,14,12,24,26,13,15,17,19,21,23,25,
%T A268182 27,54,52,50,48,46,44,42,40,38,36,34,32,30,28,56,58,29,31,33,35,37,39,
%U A268182 41,43,45,47,49,51,53,55,57,59
%N A268182 A solution to a(n+1) in {a(n)+2, a(n)-2, a(n)*2, a(n)/2} which is a rearrangement of the natural numbers.
%C A268182 Use algorithm: when a(n)=2k+1 2k+1 -> 4k+2, 4k, 4k-2, 4k-4, ...-> 2k+2 -> *2-> 4k+4 +2-> 4k+6 -> /2-> 2k+3, 2k+5, +2... ->4k+7. This covers all numbers between 2k+1 and 4k+7 and then the algorithm can be reapplied.
%H A268182 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A268182 a(n) = n if and only if n is a positive term of A168616. Also, for j > 2, a(n) < a(2^j - 5) if and only if n < 2^j - 5. - _Rick L. Shepherd_, May 22 2016
%o A268182 (PARI) {get_next_stage(v) = local(k = (v[#v] - 1)/2);
%o A268182 forstep(m = 2*v[#v], 2*k + 2, -2, v = concat(v, m));
%o A268182 v = concat(v, [2*v[#v], 4*k + 6]);
%o A268182 forstep(m = v[#v]/2, 4*k + 7, 2, v = concat(v, m)); v}
%o A268182 a = [2, 1, 3]; \\ code assumes last entry here is odd.
%o A268182 \\ n-th call to function returns 2^(n + 2) more terms
%o A268182 while (#a < 59, a = get_next_stage(a)); a \\ _Rick L. Shepherd_, May 21 2016
%Y A268182 Cf. A168616.
%K A268182 nonn
%O A268182 1,1
%A A268182 _Toby Chamberlain_, Jan 28 2016