We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
see: https://console.cloud.google.com/functions/details/us-central1/eventstream-in?env=gen2&project=eventstream-dev
package gcfv2; import java.io.BufferedWriter; import java.math.BigInteger; import com.google.cloud.functions.HttpFunction; import com.google.cloud.functions.HttpRequest; import com.google.cloud.functions.HttpResponse; public class HelloHttpFunction implements HttpFunction { public static long counter = 0; public static final BigInteger COLLATZ_2651 = new BigInteger("2367363789863971985761"); private BigInteger path = BigInteger.ZERO; private BigInteger height = BigInteger.ZERO; public void compute(BigInteger start) { } private void computeSingleThreaded(BufferedWriter writer, BigInteger start) throws Exception { BigInteger current = start; long startTime = System.currentTimeMillis(); while (current.compareTo(BigInteger.ONE) > 0) { // odd integers follow if(current.testBit(0)) { current = current.shiftLeft(1).add(current).add(BigInteger.ONE); } else { current = current.shiftRight(1); } path = path.add(BigInteger.ONE); if(current.compareTo(height) > 0) { height = current; } //if(displayIterations) { //System.out.println(start + "," + current + "," + path + "," + height); //} } long time = System.currentTimeMillis() - startTime; //System.out.println("start,path,max,ms"); writer.write(start + "," + path + "," + height + "," + time); } public void service(final HttpRequest request, final HttpResponse response) throws Exception { final BufferedWriter writer = response.getWriter(); counter++; //writer.write("Count: " + counter); BigInteger start = COLLATZ_2651;//BigInteger.valueOf(27); computeSingleThreaded(writer, start); } }
The text was updated successfully, but these errors were encountered:
obriensystems
No branches or pull requests
see:
https://console.cloud.google.com/functions/details/us-central1/eventstream-in?env=gen2&project=eventstream-dev
The text was updated successfully, but these errors were encountered: