login
a(1)=2. For n >= 1, let k = floor(log a(n)). If k >= 2 and k is not already in the sequence then a(n+1)=k, otherwise a(n+1)=a(n)^2.
3

%I #20 Nov 22 2016 21:53:59

%S 2,4,16,256,5,25,3,9,81,6561,8,64,4096,16777216,281474976710656,33,

%T 1089,6,36,1296,7,49,2401,5764801,15,225,50625,10,100,10000,100000000,

%U 18,324,104976,11,121,14641,214358881,19,361,130321,16983563041,23,529,279841,12,144,20736,429981696,184884258895036416,39

%N a(1)=2. For n >= 1, let k = floor(log a(n)). If k >= 2 and k is not already in the sequence then a(n+1)=k, otherwise a(n+1)=a(n)^2.

%C Does every number >= 2 appear?

%C Suggested by a posting to the Math Fun Mailing List by Keith F. Lynch, Mar 21 2013.

%C See A277848 for the index of a given number, i.e., the left inverse of this function. - _M. F. Hasler_, Nov 20 2016

%H Alois P. Heinz, <a href="/A217727/b217727.txt">Table of n, a(n) for n = 1..662</a>

%p Digits:=100;

%p a1:=[2,4,16];

%p s1:=convert(a1,set);

%p for n from 3 to 50 do

%p t1:=a1[n];

%p k:=floor(log(t1));

%p if k >= 2 then

%p if evalb(k in s1) then a1:=[op(a1),t1^2]; s1:= s1 union {t1^2}

%p else a1:=[op(a1),k]; s1 := s1 union {k}; fi;

%p else

%p a1:=[op(a1),t1^2]; s1:= s1 union {t1^2};

%p fi;

%p od:

%p [seq(a1[i],i=1..nops(a1))];

%t a = {2}; Do[If[And[# >= 2, ! MemberQ[a, #]], AppendTo[a, #], AppendTo[a, a[[n]]^2]] &@ Floor@ Log@ a[[n]], {n, 50}]; a (* _Michael De Vlieger_, Nov 22 2016 *)

%o (PARI) A217727(n,show_all=0,a=2,u=[])={for(i=2,n, show_all&&print1(a","); u=setunion(u, [a]); while(#u>1&&u[2]==u[1]+1, u=u[^1]); my(t=log(a)\1); a=if(t>u[1]&&!setsearch(u, t), t, a^2));a} \\ _M. F. Hasler_, Nov 22 2016

%Y Cf. A114183.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, Mar 21 2013