Here you can find the source of factorStream(long number)
public static LongStream factorStream(long number)
//package com.java2s; //License from project: Apache License import java.util.stream.LongStream; public class Main { public static LongStream factorStream(long number) { return LongStream.rangeClosed(2, (long) Math.sqrt(number)) .filter(f -> number % f == 0)/* ww w . j a v a2 s. c o m*/ .flatMap(f -> LongStream.of(f, number / f)) .sorted(); } }