My name is yuki. Thanks to DMMWEBCAMP, I am now working as a WEB engineer, gathering my friends to develop services, tutoring programming, and enjoying my engineer life every day.
We also provide support and error questions for those who are aiming from inexperienced, so if you are interested, please contact DM.
I used to be a high school teacher in the Japanese language department in the liberal arts, but now I am having a good time in my upper career. I had learned mathematics up to 2B when I took the university entrance exam, but it was very useful when programming.
If you were in high school ** "I avoided math for a while ... but I think I can use my ideas for programming ..." **, this time I can study and review math and programming at the same time. Introducing ** Project Euler **.
Read as Project Euler. https://projecteuler.net/
The description is [wiki](https://ja.wikipedia.org/wiki/%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3 Quoted from% 83% 88% E3% 83% BB% E3% 82% AA% E3% 82% A4% E3% 83% A9% E3% 83% BC).
Project Euler (English: Project Euler, named after Leonhard Euler) is mainly used by adults and students who are interested in mathematics and programming, and solves a series of calculation problems by programming (computer). This is the intended website. In addition to the problems of 400 or more [2], one question is added every weekend, and various difficult questions are prepared, but if you use an efficient algorithm on a personal computer with general specifications, each one will be 1 minute. Can be solved in less than.
After studying at a programming school, I wanted to take revenge on math, so I was working on it. The repository solved by ruby is here. (I did it up to 50th place.)
There were a lot of mathematical problems and problems that were difficult to output, so I was very smart.
Let's try the first question. Before that, there was a Japanese site before, but it's down ...
With that said, let's put in a great extension that translates the original site first. https://chrome.google.com/webstore/detail/project-euler-translate-i/oeicjfkbfahmdklgoollemcahaljgklo?hl=ja
Of natural numbers less than 10,3 or a multiple of 5 is 3, 5, 6,There are 4 of 9,The sum of these is 23.
In the same way,Find the sum of numbers that are multiples of 3 or 5 less than 1000.
What is a natural number ...? If you think that, it's okay. Let's go around.
answer.rb
max_number = 1000
answer = 0
for num in 1..max_number -1
if num % 3 == 0 || num % 5 == 0
answer = answer + num
end
end
puts answer
It's an answer I made in the past, so there may be a better way.
Nowadays, many people change jobs from liberal arts to engineers, and I think it is very important to look back on mathematics. I can't say it because I've only taken up to 2B, but I didn't dislike mathematics itself, so it's logical to say ** "subdivide the problem, build logic and arrive at the answer" **. I feel that thinking is very much alive in programming.
However, it is difficult to pull out the textbook and start over from scratch, and I thought it would be good to do it while studying programming, so I introduced it.
After doing Project Euler, I fell in love with math, which I didn't dislike. Because the "program" does the calculations for you. Until now, I used a troublesome formula, and while being careful about calculation mistakes, I used to make notes dirty and solve math, but ** if there is logic, ** the answer will come out beautifully, so it is very pleasant did.
Maybe it will help you overcome your dislike of math, so please give it a try.
Recommended Posts