Skip to content

Instantly share code, notes, and snippets.

@lapo-luchini
Last active October 5, 2021 22:53
Show Gist options
  • Save lapo-luchini/690a1e4d7394f1a409ebe7c040715f27 to your computer and use it in GitHub Desktop.
Save lapo-luchini/690a1e4d7394f1a409ebe7c040715f27 to your computer and use it in GitHub Desktop.
Generates flashcards to study multiplications and division of numbers up to 100. Can be imported into Anki via the File→Import option, use "Basic" type cards.
// generates flashcards to study multiplications and division of numbers up to 100
// can be imported into Anki via the File→Import option, use "Basic" type cards
let x = {};
for (let a = 2; a <= 100; ++a)
x[a] = [];
for (let a = 2; a < 100; ++a)
for (let b = a; b < 100; ++b) {
let m = a * b;
if (m > 100)
continue;
x[m].push(a + '×' + b);
}
// console.log(x);
for (const [k, v] of Object.entries(x)) {
let s = 'primo';
if (v.length) {
s = v.join('\n');
if (v.length > 1)
s = '"' + s + '"';
}
console.log(k + '\t' + s);
for (let s of v)
console.log(s + '\t' + k);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment