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.

A050128 a(n) = floor(a(n-1)/2) if this is not among 0, a(1), ..., a(n-1); otherwise a(n) = 2*n.

This page as a plain text file.
%I A050128 #23 Feb 09 2020 15:31:39
%S A050128 1,4,2,8,10,5,14,7,3,20,22,11,26,13,6,32,16,36,18,9,42,21,46,23,50,25,
%T A050128 12,56,28,60,30,15,66,33,70,35,17,76,38,19,82,41,86,43,90,45,94,47,98,
%U A050128 49,24,104,52,108,54,27,114,57,118,59,29,124
%N A050128 a(n) = floor(a(n-1)/2) if this is not among 0, a(1), ..., a(n-1); otherwise a(n) = 2*n.
%C A050128 Does this sequence contain every positive integer exactly once?
%H A050128 Robert Israel, <a href="/A050128/b050128.txt">Table of n, a(n) for n = 1..10000</a>
%p A050128 N:= 100: # for a(1)..a(N)
%p A050128 V:= Vector(N): S:= {0,1}:
%p A050128 V[1]:= 1:
%p A050128 for n from 2 to N do
%p A050128   v:= floor(V[n-1]/2);
%p A050128   if member(v, S) then V[n]:= 2*n
%p A050128   else V[n]:= v
%p A050128   fi;
%p A050128   S:= S union {V[n]}
%p A050128 od:
%p A050128 convert(V,list); # _Robert Israel_, Feb 09 2020
%t A050128 f[s_List] := Block[{len = Length@s, m = Floor[s[[-1]]/2]}, Append[s, If[MemberQ[s, m], 2 len, m]]]; Rest@Nest[f, {0, 1}, 65] (* _Robert G. Wilson v_, Aug 09 2018 *)
%Y A050128 Cf. A050000, A050129, A050130, A050131, A050132.
%K A050128 nonn,look
%O A050128 1,2
%A A050128 _Clark Kimberling_