I don't know if it's a lot of work but it could be a good idea to add a Prime Numbers group 2 with more difficult problems. I think about beautiful Ned's problems (primes ladders, Longest prime diagonal, Twins in a window ...).
My logic is right but test cases are very hude numbers.... failed to evaluate...
You need to learn to avoid loops. You can use isprime on an array. In any case, your logic is wrong. You never test that b is prime.
As Guillaume pointed out, this solution doesn't test if the numbers in b are Mersenne primes, simply if they're less than 2^n-1, which is not the right criterion. Further, you concatenate the index of the loop (j, which goes from 1 to 1...), rather than a Mersenne prime to b.
Also, this problem is designed, as many of James's problems are, to fail by timeout unless vectorized solutions are used.
i have corrected the logic but plz can u tell me smthing about vectorized solutions...
u can also mail me on email@example.com
some tips: http://nl.mathworks.com/help/matlab/matlab_prog/techniques-for-improving-performance.html
Finding Perfect Squares
Rotate a Matrix
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
Remove the Zero
I Plead the Fifth
Lights Out 7 - 5x5, x moves
Scrabble Scores - 10
Radiation Heat Transfer — View Factors (2)
Lights Out 9 - 5x5, light-only solution? II
5th Time's a Charm
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office