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 port = 3000 | |
| require('http') | |
| .createServer((req, res) => { | |
| console.log('url:', req.url) | |
| res.end('hello smartcoding') | |
| }) | |
| .listen(port, (error)=>{ | |
| console.log(`server is running on ${port}`) | |
| }) |
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
| #!/bin/python3 | |
| import math | |
| def max_prime_factor(n): | |
| maxPrime = -1 | |
| # We keep dividing n by 2 to get rid of all the even composite factors. | |
| while n % 2 == 0: | |
| maxPrime = 2 | |
| n >>= 1 # equivalent to n //= 2 |
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
| #!/bin/python3 | |
| def is_prime(n): | |
| if n < 2: | |
| return False | |
| ps = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97] | |
| def is_spsp(n, a): | |
| d, s = n-1, 0 |
OlderNewer