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 LogicPro Your Own Question
LogicPro
LogicPro, Computer Software Engineer
Category: Programming
Satisfied Customers: 13164
Experience:  Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
29751445
Type Your Programming Question Here...
LogicPro is online now

Given n a positive integer greater than or equal to 1, write

Resolved Question:

Given n a positive integer greater than or equal to 1, write a function f(n) to calculate as efficiently as possible the sum of the first 1 to n powers of 2. Do not use any built in function to calculate the power of a number.

Example: if n = 3: 
f(3)=2^1+2^2+2^3=2+4+8=14

Your program will read the value of n from stdin and should output the value of f(n) on the next line.

Note: Any language is fine - preferably perl, python or ruby.

Submitted: 2 years ago.
Category: Programming
Expert:  adamd-mod replied 2 years 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 2 years ago.

Hi Adam,

Yep that's absolutely fine - I'm more than happy to wait. :)

Thanks!

Expert:  adamd-mod replied 2 years ago.

Hello,

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

Thank you for your patience,

Adam

Expert:  LogicPro replied 2 years ago.
Hi
Welcome
I can write it in python.
Whcih version of python you are using?
Expert:  LogicPro replied 2 years ago.
Download sumOfPowersOfTwo.py

You can ask me again using "For LogicPro only" at the start of your questions like other customers to get instant answers. It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

We can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions and I’m always here to help.

Thank you for using this site!


LogicPro, Computer Software Engineer
Category: Programming
Satisfied Customers: 13164
Experience: Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
LogicPro and other Programming Specialists are ready to help you
Customer: replied 2 years ago.

Hi there,

I have another question up at the moment which I'm thinking about assigning over to you if you're interested? I would need this for within the next couple of hours though but I'm happy to pay well for the request.

TASK:

Develop a process that can consume web access log files and emit the following metrics:

- No. of successful requests per minute
- No. of error requests per minute
- Mean response time per minute
- MBs sent per minute

Please use the following Web access log file to verify your process:

https://dl.dropboxusercontent.com/u/9679985/web-access.log

Log format (http://httpd.apache.org/docs/2.2/mod/mod_log_config.html):

"%a %l %u %t \"%r\" %>s %b %D"

Expert:  LogicPro replied 2 years ago.
I am out of ideas for this one. I will be happy to help you with other questions.