Sha256: 3e99b17e57414e7cc69e7cdba96856c9d3b29e4c05f6c98d57c49bc1745e38be
Contents?: true
Size: 532 Bytes
Versions: 68
Compression:
Stored size: 532 Bytes
Contents
#import "PrimeFactorsExample.h" @implementation PrimeFactors + (NSArray <NSNumber *> *)factorsForInteger:(long long)integer { long long number = integer; long long divisor = 2; NSMutableArray <NSNumber *> *primes = [[NSMutableArray alloc] init]; while (number > 1) { while (number % divisor == 0) { // !OCLint [primes addObject:[NSNumber numberWithLongLong:divisor]]; number /= divisor; } divisor++; } return primes; } @end
Version data entries
68 entries across 68 versions & 1 rubygems