Globaltech Research Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

p & p^2+8 are primes, if p not equal to 2.

p*(p^2 + 8) is not prime as it is factored into prime numbers......(p^3+p*8)

To make it prime, we need to convert p*8 into something not divisble by p,

We take 2 in this case. So, it makes (p^3+2^4) a prime....this cannot be factored furthur.

Can someone comment on the solution ?

- oxygen August 13, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i m not sure if the argument is correct bcos P & P^2 + 8 is not prime even in case of P=5,
infact ur argument "We take 2 in this case. So, it makes (p^3+2^4) a prime....this cannot be factored furthur" is leading to the generalization that we can have even P^3 + 2^n as prime, so i m not sure if it is the correct way of proving.....

- lk August 14, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

lk, ur argument is correct. Perhaps, we can assume p & p^2+8 are primes. p cannot be '2' is a case. There are can be other cases as well, like '5'. Have to think more on this...m not good @ number theory.

Maybe someone else can help ?

- Anonymous August 14, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Any prime integer p can be written as 6k+1 or 6k-1, except 2,3.
when p!=2,3 then..ie p=6k(+/-)1
p^2+8 = 36k^2 (+/-) 12k + 9
...... this is a multiple of 3 n also greater than 8 and hence cannot be prime if p!=2,3...!
if p=2... p^2+8 cannot be prime obviously..
that leaves us with p=3 case..
p^2+8 = 17 (prime)
p^3+16 = 43 (prime) n proved!!!

- nc September 10, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We know that p is surely an odd number there p^2 when divided by 3 must leave a remainder 1.(obviously it cant have remainder 0 ;it would be multiple of 3 ( here I m not considering case p=3)and not even two it can be shown easily by letting the number of form 3k+r where r=1,2)
Now we know p^2=3m+1 so p^2+8=3m+9 =3(m+3) so it isnt prime
Now all cases have been rejected except for p=3; p^2+8=17 and p^3+16=43 .
So done p=3 satisfies it and that's the only answer:)

- Aneesh May 14, 2020 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More