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.

A050138 a(1)=2, a(2)=6. For n >= 2, a(n) = floor(a(n-1)/2) if this is not among 0,a(1),...,a(n-1); otherwise a(n) = 3*n.

This page as a plain text file.
%I A050138 #26 Oct 15 2019 11:52:26
%S A050138 2,6,3,1,15,7,21,10,5,30,33,16,8,4,45,22,11,54,27,13,63,31,69,34,17,
%T A050138 78,39,19,9,90,93,46,23,102,51,25,12,114,57,28,14,126,129,64,32,138,
%U A050138 141,70,35,150,75,37,18,162,81,40,20,174,87,43
%N A050138 a(1)=2, a(2)=6.  For n >= 2, a(n) = floor(a(n-1)/2) if this is not among 0,a(1),...,a(n-1); otherwise a(n) = 3*n.
%C A050138 Does this sequence contain every positive integer exactly once?
%C A050138 Inverse: 4, 1, 3, 14, 9, 2, 6, 13, 29, 8, 17, 37, 20, 41, 5, 12, 25, 53, ..., . - _Robert G. Wilson v_, Apr 09 2018
%H A050138 Robert Israel, <a href="/A050138/b050138.txt">Table of n, a(n) for n = 1..10000</a>
%p A050138 S:= {0,2,6}: A[1]:= 2: A[2]:= 6:
%p A050138 for n from 3 to 100 do
%p A050138   t:= floor(A[n-1]/2);
%p A050138   if member(t, S) then t:= 3*n fi;
%p A050138   A[n]:= t;
%p A050138   S:= S union {t};
%p A050138 od:
%p A050138 seq(A[n],n=1..100); # _Robert Israel_, Apr 09 2018
%t A050138 f[s_] := Block[{b = Floor[s[[-1]]/2], l = Length@ s}, Append[s, If[MemberQ[s, b], 3l, b]]]; s = {0, 2, 6}; Nest[f, s, 57] (* _Robert G. Wilson v_, Apr 09 2018 *)
%Y A050138 Cf. A050000, A050128, A050135, A050136, A050136, A050138.
%K A050138 nonn,look
%O A050138 1,1
%A A050138 _Clark Kimberling_
%E A050138 Name corrected by _Robert Israel_, Apr 09 2018