The first test case is wrong 0 and 21 are triangular numbers too (https://oeis.org/A000217), therefore:
[ 0, 6;
PS: And 0 does not make a pair with every number in this case.
What's wrong with the case x=20 in test suite? Why is y_correct=[ 10 10] ? I cannot pass it.
I don't know why your cheat isn't working, but look closely at what numbers your "for n=1:N" loop generates for that case.
Project Euler: Problem 8, Find largest product in a large string of numbers
Implement simple rotation cypher
Television Screen Dimensions
Create matrix of replicated elements
Mersenne Primes vs. All Primes
Golomb's self-describing sequence (based on Euler 341)
It's Happy! It's Fun! It's Happy Fun Hyperball!
Singularity v5 (with apologies to the true hack masters)
High Precision Square Root (Inspired by Project Euler 80)
Muphry's Law of MATLAB
Find the treasures in MATLAB Central and discover how the community can help you!
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