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
import math | |
def divide(a): | |
b = int(a / 2) | |
if a % 2 == 1: | |
return [b, b + 1] | |
return [b, b] | |
def factorization(a): | |
primes = [] |
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
function divide( a:int ):Array | |
{ | |
var b:int = int( a/2 ); | |
if( a%2 == 1 ) return [ b, b+1 ]; | |
else return [ b, b ]; | |
} | |
function factorization( a:int ):Array | |
{ | |
var primes:Array = []; |
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
//정수의 인수분해 | |
function factorization( a:int ):Array | |
{ | |
var primes:Array = []; | |
var factor:int = 2; | |
if( a<2 ) return [ a ]; | |
while( a>1 ) | |
{ | |
while( a%factor ) ++factor; | |
primes.push( factor ); |
NewerOlder