Problem 5. Triangle Numbers
Solution Stats
Problem Comments
-
24 Comments
i dint realize i was writing a code for sum of first n natural numbers instead of computing n*(n+1)/2
Man, this takes me back to algebra... Its more fun in MATLAB tho!
It's interesting to work with and building the confidence to solve problems....nice
Good one. Reminds me of those old school days..!!
All solutions with score 10 or 11 use the regexp cheat.
Jon or anybody!
Can you explain how the regexp cheat works?
How do you reduce the size of your code?
mucha fantasía en el titulo
what it means?
I really had to use my brain for this problem
Interesting!
sound simple but annoying
Funny and interesting problem!
good!
For clarity sake,
t = triangle (n)
We need to calculate t for a given n
It is pretty easy but tricky!
Why doesn't this work?
function t = triangle(n)
t=1
for i=[1:(n+1)]
t=t+i;
t
end
that was fun
Cool problem!
Interesting
cool
The formula makes this an easy math problem.
Good Question
+10 points
Solution Comments
Show commentsProblem Recent Solvers26706
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
48174 Solvers
-
2902 Solvers
-
Project Euler: Problem 3, Largest prime factor
1400 Solvers
-
Rounding off numbers to n decimals
4319 Solvers
-
848 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!