How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Jerubedo Your Own Question

Jerubedo
Jerubedo, Computer Software Engineer
Category: Programming
Satisfied Customers: 146
Experience:  I specialize in Java, Java EE, PHP, mySQL, HTML5, Javascript, LifeRay Portal, CSS, eclipse, netbeans, and SVN.
25574478
Type Your Programming Question Here...
Jerubedo is online now

I am planning to go to a coding boot camp and am doing some

Customer Question

I am planning to go to a coding boot camp and am doing some pre course work on ruby coding and need help with some tasks. Can you give me some 1 to 1 suppot
Submitted: 1 year ago.
Category: Programming
Expert:  adamd-mod replied 1 year ago.

Hello there,

I've been working hard to find a Professional to assist you with your question, but sometimes finding the right Professional can take a little longer than expected.

I wonder whether you're ok with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you.

Please note, I am just a moderator for this category, I can only try and find experts to help, I can't answer the question itself.

Thank you!

Adam

Customer: replied 1 year ago.

Thank you for the reply. This is the main question I have:

Using Ruby, I am trying to find the Sum of all the Prime Numbers less than 100 using the 'Sieve of Eratosthenes' method. I do not wish to use:

require 'prime'

Prime.each(100).reduce(:+)

method, since while it gives me what I want, it does not use Sieve of Eratosthenes (its too simplistic).

If possible, an in depth explanation would be the best help if possible.

Thank you again.

Expert:  adamd-mod replied 1 year ago.

Hello,

We will continue to look for a Professional to assist you.

Thank you for your patience,

Adam

Expert:  Jerubedo replied 1 year ago.
Hello there. I can certainly help you with this. Here is the full code with comments to help you understand what is happening and when:def eratosthenes(n)# ***** odd x, if x is prime, nums[x >> 1] is true.# ***** false for all multiples of 3.nums = [true, false, true] * ((n + 5) / 6)nums[0] = false # ***** is not prime.nums[1] = true # ***** is prime.# ***** loop and both inner loops are skipping multiples of 2 and 3.# ***** loop checks x * x > n, same as x > Math.sqrt(n).x = 5until (m = x * x) > nif nums[x >> 1]x_times_2 = x << 1x_times_4 = x << 2while m <= nnums[m >> x] = falsem += x_times_2nums[m >> 1] = falsem += x_times_4 # ***** x = 5, skip 45, 75, 105, ...endendx += 2if nums[x >> 1]m = x * xx_times_2 = x << 1x_times_4 = x << 2while m <= nnums[m >> 1] = falsem += x_times_4 # ***** x = 7, skip 63, 105, 147, ...nums[m >> 1] = falsem += x_times_2endendx += 4endprimes = [2]nums.each_index {|x| primes << (x * 2 + 1) if nums[x]}primes.pop while primes.last > nprimesendp eratosthenes(100)
Expert:  Jerubedo replied 1 year ago.
Hello, I was just checking in to see if you had seen the above answer and if it answered your question. If it did, please remember to rate me as that is the only way I am compensated for my time. Let me know if you need anything else!
Expert:  Jerubedo replied 1 year ago.
.

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer
< Previous | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C.
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C.
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7260
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7260
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5514
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    936
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    766
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    558
    Founder of StockCanvas.com
  • http://ww2.justanswer.com/uploads/FA/fael/2011-1-15_104041_profile500x500.64x64.jpg Rafael Martins's Avatar

    Rafael Martins

    Computer Software Engineer

    Satisfied Customers:

    446
    Desktop, Mobile and Web Developer. 7+ years of experience. Creative solutions provider.
  • http://ww2.justanswer.com/uploads/CH/chutz747/2011-11-6_14231_me.64x64.jpg The-PC-Guy's Avatar

    The-PC-Guy

    Software Engineer

    Satisfied Customers:

    320
    Extensive Knowledge in PHP, MYSQL, CSS & Javascript