Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
function* nPowerGen(n) {
|
||||
let e = 0;
|
||||
while (1) { e++ && (yield Math.pow(e, n)); }
|
||||
}
|
||||
|
||||
function* filterGen(gS, gC, skip=0) {
|
||||
let s = 0; // The square value
|
||||
let c = 0; // The cube value
|
||||
let n = 0; // A skip counter
|
||||
|
||||
while(1) {
|
||||
s = gS.next().value;
|
||||
s > c && (c = gC.next().value);
|
||||
s == c ?
|
||||
c = gC.next().value :
|
||||
n++ && n > skip && (yield s);
|
||||
}
|
||||
}
|
||||
|
||||
const filtered = filterGen(nPowerGen(2), nPowerGen(3), skip=20);
|
||||
Loading…
Add table
Add a link
Reference in a new issue