import HFM.Primes(primePowerFactors)
import Data.List
factors = map product.
mapM (uncurry((. enumFromTo 0) . map .(^) )) . primePowerFactors
public static TreeSetfactors(long n){ TreeSet factors = new TreeSet (); factors.add(n); factors.add(1L); for(long test = n - 1; test >= Math.sqrt(n); test--){ if(n % test == 0){ factors.add(test); factors.add(n / test); } } return factors; }
from math import ceil, sqrt
def factor(n):
return sorted(set(sum( ([x ,n / x] for x in range(1, ceil(sqrt(n)) + 1) if not n % x), [])))
(define (factors n)
(define (*factors d)
(cond ((> d n) (list))
((= (modulo n d) 0) (cons d (*factors (+ d 1))))
(else (*factors (+ d 1)))))
(*factors 1))
private IEnumerablefactor(int number) { var a = Enumerable.Range(1, (int)Math.Sqrt(number)).Where(x => number % x == 0); return a.Union(a.Select(x => number / x)).OrderBy(x => x); }
'' == '0' //false 0 == '' //true 0 == '0' //true false == 'false' //false false == '0' //true false == undefined //false false == null //false null == undefined //true " \t\r\n" == 0 //trueHow about return?
return {
id: 1234,
je: 5678
};
return
{
id: 1234,
je: 5678
};
return
2+2;
Which of these statements fail?if (a == 1)
{
return a;
}
and
if (a == 1):
return a
except that the latter involves fewer keystrokes and has fewer possible mistakes.« Older Residents of the unique town of Crestone, CO (and ... | Filibustery, making the filibu... Newer »
This thread has been archived and is closed to new comments
I think I've seen people warn against W3Schools elsewhere on Meta.
posted by londonmark at 11:49 AM on January 31, 2011 [1 favorite]