hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Growing Bacteria
Goto page Previous  1, 2, 3
 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
Growing Bacteria
Author Message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 473
Location: Germany

Post Reply with quote
CodeX wrote:
I think the page you get after solving a challenge points you to the Challenges form instead of the Challenges Solved one


Quite certainly not in every case, but for some challenges this seems to be what is happening.
Tue Apr 16, 2013 9:53 pm View user's profile Send private message
meis



Joined: 28 Aug 2012
Posts: 13
Location: Italy

Post Reply with quote
I'm sorry, but I can't get how could in 8 days be 47 population. I have written a script which gives:
day: 1 - bacts: 0,1,0,0,0 - sum: 1
day: 2 - bacts: 1,0,1,0,0 - sum: 2
day: 3 - bacts: 1,1,0,1,0 - sum: 3
day: 4 - bacts: 1,1,1,0,1 - sum: 4
day: 5 - bacts: 2,1,1,1,0 - sum: 5
day: 6 - bacts: 2,2,1,1,1 - sum: 7
day: 7 - bacts: 3,2,2,1,1 - sum: 9
day: 8 - bacts: 4,3,2,2,1 - sum: 12
day: 9 - bacts: 5,4,3,2,2 - sum: 16

the array of bacts is the succession of days (batters at 1st day of life, batters at 2nd etc...)

What have I done wrong?

p.s. day 0 is 1,0,0,0,0
Sat Apr 27, 2013 5:27 pm View user's profile Send private message
meis



Joined: 28 Aug 2012
Posts: 13
Location: Italy

Post Reply with quote
Oh, now I get it, I've made a mistake in the understanding of the moment of the reproduction. Done Very Happy
Fri May 03, 2013 2:44 pm View user's profile Send private message
Luk.Online



Joined: 17 Oct 2010
Posts: 3

Post Reply with quote
I think I've programmed the correct algorithm, but is the only way to figure out the answer by iterate
Code:
while (amount < 1000000000000);
???
Tue Jun 04, 2013 6:45 pm View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
Luk.Online wrote:
I think I've programmed the correct algorithm, but is the only way to figure out the answer by iterate
Code:
while (amount < 1000000000000);
???
I'm not going to Fib, Lucas can solve it with a closed-form equation.
Tue Jun 04, 2013 7:41 pm View user's profile Send private message
Luk.Online



Joined: 17 Oct 2010
Posts: 3

Post Reply with quote
I've got an equation for the growth but not for the death...

But when I've got one for the death, can I subtract them?
Tue Jun 04, 2013 8:42 pm View user's profile Send private message
FrostyHacks



Joined: 29 Jun 2015
Posts: 1

Post Reply with quote
My solution to this was simply to write a C# app and keep track of the number of bacteria on each specific day.

So each day iteration would basically be the number of day 5 bacteria (those dead) increased by the amount from the previous day, so day 4 become day 5, day 3 become day 4, day 2 become day 3, day 1 become day 2, and day 1 is the addition of day 2+3 since those days result in new bacteria.

The total alive is just day 1+2+3+4 and the total dead is just the size of day 5

The code looks like this, you can simply hit enter to generate each new day and you'll see the totals and then skip through the days until you reach one high enough, or you could modify the code to just keep looping until the total count condition is met, I made this more general, you can put a different starting number in for example.

[Code removed by moderator]
Mon Jun 29, 2015 10:51 am View user's profile Send private message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 473
Location: Germany

Post Reply with quote
FrostyHacks, you are not supposed to post a complete solution in this section of the forum. That's what the "Challenges Solved" section is for. There, only the people who have solved a challenge can read the thread for that challenge. So it's perfectly fine to post all of your solutions there.
Sat Jul 04, 2015 7:30 am View user's profile Send private message
Bwill



Joined: 08 Sep 2015
Posts: 1

Post Reply with quote
So I just solved this using

Code:

while (population < 1000000000000)
    growBacteria()
...


Yet I am curious about the "simple algebraic" and Fibonacci solutions, anyone mind PMing me those solutions?
Wed Nov 11, 2015 6:55 am View user's profile Send private message
eulerscheZahl



Joined: 29 Nov 2012
Posts: 56
Location: Germany

Post Reply with quote
As soon as you solved the challenge, you have access to the solution forum: http://www.hacker.org/forum/viewtopic.php?t=1603&postdays=0&postorder=asc&start=15
Wed Nov 11, 2015 6:47 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.