Magic Number Fizz Buzz

Part of a ‘bad code competition’ I am not the author of this one.
 avatar
user_9431520
javascript
4 months ago
426 B
4
Indexable
function fizzbuzz() {
	const a = [3000, 781400, 1645655, 2637125, 986525, 6425, 1285];
	const b = [1, -63, 189, -1134, 3402, -378, 3402];
	const d = ['', 'fizz', 'buzz']

	for (let x = 1; x <= 100; x++) {
		let r = x % 15;
		let v = 0;
		for (let i = 0; i < 7; i++) {
			v += (a[i] * r ** i) / b[i];
		}
		v += 1 / 137;
		let z = /000/.test(v + '');
		let j = z ? v / 1000 >> 0 : 0
		console.log(d[j & 1] + d[j & 2] || x)
	}
}
Editor is loading...
Leave a Comment