This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| description = "flake empty env"; | |
| inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs | |
| outputs = | |
| { self, ... }@inputs: | |
| let | |
| supportedSystems = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| description = "flake empty env"; | |
| inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs | |
| outputs = | |
| { self, ... }@inputs: | |
| let | |
| supportedSystems = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const maxNum = num => +[...`${num}`].sort((a, b) => b - a).join(''); | |
| const minNum = num => +[...`${num}`].sort((a, b) => a - b).join(''); | |
| const reachedNums = new Set([]); | |
| const seen = {}; | |
| const findKaprekar = (i, _min, _max, prev, step) => { | |
| let diff = _max-_min; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Worker, isMainThread, parentPort, workerData } = require('worker_threads'); | |
| const os = require('os'); | |
| if (isMainThread) { | |
| // Main thread | |
| const NUM_WORKERS = os.cpus().length; | |
| const START = 100; | |
| const END = 100_000_000; | |
| const CHUNK_SIZE = Math.ceil((END - START) / NUM_WORKERS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { | |
| Worker | |
| } = require('worker_threads'); | |
| // const NUM_WORKERS = os.cpus().length; | |
| const NUM_WORKERS = 12; | |
| const START = 100; |
OlderNewer