/////////////////////////////////No.311 z in FizzBuzzString //入力文字読み取り //var inputall = require('fs').readFileSync('/dev/stdin', 'utf8'); //すべて受け取り改行で区切って格納 var inputnumber = Number(inputall); //3の倍数 var i = 1 var three = []; var threenum=0 while (true) { threenum = i * 3 if (inputnumber < threenum) { break; } three.push(threenum) i++ } //5の倍数 var i = 1 var five = []; var fivenum = 0 while (true) { fivenum = i * 5 if (inputnumber < fivenum) { break; } five.push(fivenum) i++ } //15の倍数 var i = 1 var fifteen = []; var fifteennum = 0 while (true) { fifteennum = i * 15 if (inputnumber < fifteennum) { break; } fifteen.push(fifteennum) i++ } var result = (three.length +five.length)*2 console.log(result);