{"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Finamori.hateblo.jp%2Fentry%2F20130713%2Fp1\" title=\"R\u3067Project Euler 1\u301c5 - inamori\u2019s diary\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_url":"https://hatena.blog","image_url":null,"blog_url":"https://inamori.hateblo.jp/","published":"2013-07-13 00:00:00","author_name":"inamori","type":"rich","title":"R\u3067Project Euler 1\u301c5","version":"1.0","author_url":"https://blog.hatena.ne.jp/inamori/","height":"190","url":"https://inamori.hateblo.jp/entry/20130713/p1","provider_name":"Hatena Blog","width":"100%","description":"R\u3092\u52c9\u5f37\u3057\u306a\u304f\u3066\u306f\u306a\u3089\u306a\u304f\u306a\u3063\u305f\u306e\u3067\u7df4\u7fd2\u306e\u305f\u3081\u306bProject Euler\u306e\u554f\u984c\u3092\u89e3\u3044\u3066\u307f\u307e\u3059\u3002 Problem 1 \u3075\u3064\u3046\u306b\u624b\u7d9a\u304d\u578b\u3067\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 N <- 1000 s <- 0 for(n in 1:N-1) { if(n %% 3 == 0 || n %% 5 == 0) { s <- s + n } } print(s) 1:3\u3067(1, 2, 3)\u3068\u3044\u3046\u30d9\u30af\u30c8\u30eb\u3092\u751f\u6210\u3057\u307e\u3059\u3002 \u5270\u4f59\u306f%%\u306a\u3093\u3067\u3059\u306d\u3002\u30d9\u30af\u30c8\u30eb\u3092\u4e00\u5ea6\u306b\u64cd\u4f5c\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 N <- 1000 v <- 1:N-1 w <- replace(v, which(v%%3!=0 & v%%5!=0), 0) pri\u2026","categories":["R"],"blog_title":"inamori\u2019s diary"}