Multiply Then Add, Smallest Possible Integer

Peter Pein petsie at dordos.net
Sun Jan 7 23:57:05 CET 2007


zak seidov schrieb:
> %S A127181 
> 
> 1,1,2,3,5,11,37,221,3361,190777,83199527,794428174817,783890064862614667,680985720983079851162477689,16456874347131887002906208066728704124421
> 
> My dirty (however working) Mmca:
> 
> s={1,1,2,3};di=4;
> s={1,1,2,3};di=4;Do[ra=Range[di];re=Reap[Do[rai=Subsets[ra,{i}];Do[raik=rai[[k]];co=Complement[ra,raik];Sow[Times@@(s[[#]]&/@raik)+Times@@(s[[#]]&/@co)],{k,1,i}],{i,di-1}]][[2,1]];AppendTo[s,Min[re]];di++,{11}];s
> 
> Best, Zak
> 
> --- Leroy Quet <qq-quet at mindspring.com> wrote:
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
Dear Zak, dear Seqfans,

I'm afraid, your code is incorrect. k runs up to i, but there are usually
significantly more elements in Subset[ra,{i}]. It's interesting, that
a(1)..a(11) are nevertheless correct (by chance ;-) )

I get:
Nest[Module[{prod=Times@@#1},
      Append[#,Min[#+prod/#&/@Times@@@Union[Subsets[#]]]]]&,{1,1,2,3},11]

{1,1,2,3,5,11,37,221,3361,190777,83199527,760382931109,662056785094857629,
538451433632092674800570837,12495147956629620251492228703104952798089}

With greetings,
  Peter





More information about the SeqFan mailing list