Author |
Message |
jeetee
Joined: 04 Jan 2009 Posts: 105
|
|
Growing Bacteria |
|
I think I don't get the description of the algorithm correctly.
When I calculate the first 8 days starting with one bacteria, I find that there are 48 bacterias after 8 days, not 47.
I wrote the algorithm in C++, but of course my answer isn't correct, which is to expect when I can't even work out the first 8 days manually...
Could anyone hint me out ?
|
|
Tue Mar 24, 2009 7:10 pm |
|
 |
gfoot
Joined: 05 Sep 2007 Posts: 269 Location: Brighton, UK |
|
|
|
I agree with the 8-day answer of 47, but that's through reasoning rather than simulation. Maybe we interpreted the rules differently, but I can't see how.
|
|
Tue Mar 24, 2009 10:19 pm |
|
 |
bsguedes

Joined: 24 Feb 2009 Posts: 103 Location: Porto Alegre |
|
|
|
Each bacterium is able to generate ONLY two new bacteria, one in the next day to its birth and the second in the second day after is birth. Each one of the generated bacteria follow these rules too. It is also necessary to remove from population the dead bacteria (I think that jeetee has forgotten to kill the first bacterium to get 48 instead of 47 in the 8th day).
Cheers,
Bruno.
|
|
Tue Mar 24, 2009 10:27 pm |
|
 |
E2YnDlEMXiU
Joined: 17 Mar 2009 Posts: 1
|
|
|
|
even if your counts are slightly off for the 8 day example (mine was as well), simply execute your program and see when it reaches 10**12... you can easily figure out the answer then.
|
|
Wed Mar 25, 2009 6:16 pm |
|
 |
Bierdeckel
Joined: 05 Mar 2009 Posts: 7
|
|
|
|
Its realy simple.
You could finde the answer without any coding. Math is your friend
Even with coding its realy simple. My vb-code is just 13 lines long.
|
|
Fri Mar 27, 2009 3:15 pm |
|
 |
horst
Joined: 06 Mar 2009 Posts: 24 Location: Germany |
|
|
|
I get 51 bacteria for day 8
1 => 1
2 => 3
3 => 6
4 => 10
5 => 15
6 => 25
7 => 34
8 => 51
This challenge drives me crazy...
|
|
Mon Apr 20, 2009 10:28 am |
|
 |
lukas
Joined: 26 Nov 2008 Posts: 34 Location: Germany |
|
|
|
 |
 |
I get 51 bacteria for day 8
1 => 1
2 => 3
3 => 6
4 => 10
5 => 15
6 => 25
7 => 34
8 => 51
This challenge drives me crazy... |
If one bacteria splits at day 1 you have two on day 2 and not three.
My Ruby Code was also just 8 lines long. Although a nice challenge.
|
|
Mon Apr 20, 2009 11:41 am |
|
 |
horst
Joined: 06 Mar 2009 Posts: 24 Location: Germany |
|
|
|
Ouch, thank you, I thought a bit too complicated. Got it now =)
|
|
Mon Apr 20, 2009 1:55 pm |
|
 |
homeas
Joined: 13 Nov 2008 Posts: 10
|
|
|
|
finally a challenge to relax,
why writing any code at all? - just use the windows (or pocket or xxx) calculator ...
|
|
Wed Apr 29, 2009 2:04 pm |
|
 |
bsguedes

Joined: 24 Feb 2009 Posts: 103 Location: Porto Alegre |
|
|
|
 |
 |
finally a challenge to relax,
why writing any code at all? - just use the windows (or pocket or xxx) calculator ... |
The main idea was to be an easy challenge =]
|
|
Wed Apr 29, 2009 2:54 pm |
|
 |
contagious
Joined: 12 May 2009 Posts: 35 Location: Greece |
|
|
|
fibonacci sequence... again
|
|
Sun May 31, 2009 1:54 pm |
|
 |
ellarso
Joined: 16 Nov 2008 Posts: 3 Location: Hamburg, Germany |
|
|
|
 |
 |
fibonacci sequence... again |
Not quite! In a fibonacci sequence each number is the sum of the previous two.
0,1,1,2,3,5,8,13,21,34,55,89,...
Especially, the hint for day 8 (47) does not work!
|
|
Wed Jun 24, 2009 7:52 pm |
|
 |
gfoot
Joined: 05 Sep 2007 Posts: 269 Location: Brighton, UK |
|
|
|
It is related, but discussion of exactly how should probably go in the "solved" forum...
|
|
Thu Jun 25, 2009 2:09 am |
|
 |
psycore
Joined: 18 Feb 2009 Posts: 8
|
|
|
|
Damn. I tried over weeks to create some java code for the bacteria cycle. I got the cycle of the new bacteria kind in code. Then I remembered the current topic of our maths lessons. Two minutes of calculator action. But hey, at least I learned a lot about coding java.
And to the guys wondering about the cycle. It says that there is that cycle for a bacteria and that scientist have found a new kind of that bacteria. But really, don't focus on the cycle so much.
|
|
Wed Jul 01, 2009 5:45 pm |
|
 |
Mosher
Joined: 21 Dec 2008 Posts: 3
|
|
|
|
Found a rather simple solution via Access
Code excerpt as follows (don´t wonder about german words, i´m german ^^)
 |
 |
x = 1
a = 1
b = 0
c = 0
d = 0
e = 0
...
|
s is the amount of bacteria after day x
a, b, c, d, and e are the amount of bacteria which are in stadium 1, 2, 3, 4, 5 accordig to challange´s description
a1, b1, c1, d1 are auxiliary variables to save the old data for preventing circle-referrence between variables
|
|
Fri Jan 22, 2010 9:59 pm |
|
 |
|