This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from JakubDrozd/beta
Version 0.2.0
- Loading branch information
Showing
26 changed files
with
2,680 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
git-commit.sh | ||
/source.zip | ||
/node_modules | ||
/node_modules | ||
/.nyc_output |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = S3; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = V1; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = W1; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = W2; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = W3; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = W4; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ | ||
// Have to do... | ||
// Module export | ||
module.exports = W5; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* JSprimecount is a fast implementation of algorithms calculating the prime-counting function. | ||
Copyright © 2021 Jakub Drozd | ||
For full notice see pi.js */ | ||
For full notice see main.js at the top level directory. */ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,33 +16,55 @@ You should have received a copy of the GNU General Public License | |
along with this program. If not, see https://www.gnu.org/licenses/. | ||
E-mail: [email protected] */ | ||
// Import of modules | ||
const { pismall } = require('./JSprimesieve/utilities.js'); | ||
const utilities = require('./JSprimesieve/utilities.js'); | ||
const { hideBin } = require('yargs/helpers'); | ||
const yargs = require('yargs'); | ||
const validators = require('./cmdvalidators.js'); | ||
// License | ||
const licensePrinter = () => { | ||
console.log('JSprimecount Copyright © 2021 Jakub Drozd'); | ||
console.log('This program comes with ABSOLUTELY NO WARRANTY; for details see https://github.com/JakubDrozd/JSprimecount/blob/main/LICENSE.txt.'); | ||
console.log('This is free software, and you are welcome to redistribute it under certain conditions; see the above link for details.'); | ||
}; | ||
const startTime = new Date(); | ||
// Yargs logic | ||
const options = yargs(hideBin(process.argv)) | ||
.usage('Usage: $0 x [options]') | ||
.command('$0 <x>', false, yargs => { | ||
.usage('Usage: $0 x [options]') | ||
.command('$0 [x]', false, yargs => { | ||
return yargs.positional('x', { | ||
describe: 'The number for computing the prime-counting function.', | ||
conflicts: 'phi', | ||
type: 'number' | ||
}); | ||
}, argv => { | ||
validators.xValidator(argv.x); | ||
}) | ||
.option('n', { | ||
alias: 'nth-prime', | ||
description: 'Compute the n-th prime' | ||
}) | ||
.help() | ||
.alias('help', 'h') | ||
.alias('version', 'v') | ||
.locale('en') | ||
.strict() | ||
.argv; | ||
// License | ||
console.log('JSprimecount Copyright © 2021 Jakub Drozd'); | ||
console.log('This program comes with ABSOLUTELY NO WARRANTY; for details see https://github.com/JakubDrozd/JSprimecount/blob/main/LICENSE.txt.'); | ||
console.log('This is free software, and you are welcome to redistribute it under certain conditions; see the above link for details.'); | ||
if (argv.x !== undefined) { | ||
licensePrinter(); | ||
validators.xValidator(argv.x); | ||
console.log(utilities.pismall(argv.x)); | ||
} | ||
}) | ||
.option('phi', { | ||
describe: 'phi(x, a) counts the numbers <= x that are not divisible by any of the first a primes. Syntax: --phi <x> <a>.', | ||
nargs: 2 | ||
}) | ||
.option('time', { | ||
describe: 'Display time in seconds.', | ||
type: 'boolean' | ||
}) | ||
.help() | ||
.alias('help', 'h') | ||
.alias('version', 'v') | ||
.locale('en') | ||
.strict() | ||
.argv; | ||
|
||
if (options.phi) { | ||
validators.phiArgValidator(options.phi[0], options.phi[1]); | ||
const primes = utilities.ersieve(utilities.nthprimeapprox(options.phi[1])); | ||
// console.log(utilities.phismall(options.phi[0], options.phi[1], primes)); | ||
console.log(utilities.phismall(options.phi[0], options.phi[1], primes)); | ||
} | ||
|
||
console.log(pismall(options.x)); | ||
if (options.time) { | ||
const endTime = new Date(); | ||
console.log(`${(endTime - startTime) / 1000} seconds`); | ||
} |
Oops, something went wrong.