Рассчитайте зерна на данном квадрате на шахматной доске JS
//Calculate Grains on a given square on a chessboard
const totalGrains = 2 ** 64 - 1;
const grainsOn = (input) => {
const grainCount = 2 ** (input - 1);
return grainCount;
};
console.log(`Grains on 6th square: ${grainsOn(6)}`);
console.log(`Total grains on the Chess Board: ${totalGrains}`);
Foolish Fox