OFFSET
1,2
COMMENTS
Every number appears and no number is repeated.
Conjecture: a(2^n) is prime if n is not 0 nor 2.
Conjecture: for n>2, every odd prime >4 is encountered in order at a(2^n-1), a(2^n). - Bill McEachen, May 06 2014
LINKS
EXAMPLE
a(8) = 7 as the least number not included earlier. a(9) = 2*a(8) = 2*5=10,
a(10) = 2*a(6) = 16, a(11) = 2*a(5) = 12, a(12)= 5*a(4) = 20 as 8, 12 and 16 have already been included.
MAPLE
did := [1]; lef := []; for n from 2 to 1000 do lef := [op(lef), n]; od : tak2n := proc(n2n) local i; global lef; i := op(1, lef); lef := subsop(1=NULL, lef); RETURN(i); end : tak := proc(n2n) local noffs, need, lefi, nindx, aa, mul; global lef, did; for noffs from -1 to -n2n+1 by -1 do nindx := n2n+noffs; aa := did[nindx]; for mul from 2 to 10000 do need := aa*mul; if member(need, lef, 'lefi') = true then break; fi; od : lef := subsop(lefi=NULL, lef); printf("%d, ", need); did := [op(did), need]; od : RETURN(ret); end : printf("1, "); for bas from 1 to 5 do nstrt := 2^bas; a := tak2n(nstrt); printf("%d, ", a); did := [op(did), a]; tak(nstrt); od : # R. J. Mathar, Mar 27 2006
# second Maple program:
ina:= proc(n) evalb(n<3) end:
a:= proc(n) option remember; local k, i, t;
if n<3 then n
else a(n-1);
k:= n-2^ilog2(n);
t:= `if`(k=0, 1, a(n-2*k));
for i from 2*t by t while ina(i) do od;
ina(i):= true; i
fi
end:
seq(a(n), n=1..70); # Alois P. Heinz, Feb 07 2011
MATHEMATICA
f[s_] := Block[{k = 2, len = Length@s}, exp = Ceiling[Log[2, len]]; m = s[[2^exp - len + 1]]; While[MemberQ[s, k*m], k++ ]; Append[s, k*m]]; Rest@Nest[f, {1, 1}, 70] (* the programming trick is to set a(0)=1 *) (* Robert G. Wilson v *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Amarnath Murthy, Jul 07 2005
EXTENSIONS
More terms from R. J. Mathar, Mar 27 2006
Edited and extended by Robert G. Wilson v, Jun 14 2006
STATUS
approved