This file contains hidden or 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 java.math.BigInteger | |
fun main() { | |
val factors = semiprimeFactors(BigInteger("769817083110377")) | |
println("Factors: $factors") // Factors: (13685611, 56250107) | |
} | |
/** | |
* Fermat's factorization method: https://en.wikipedia.org/wiki/Fermat%27s_factorization_method | |
* Semiprime n = a^2 - b^2 = (a - b) * (a + b) |
This file contains hidden or 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
package dev.goodwin | |
import android.app.Activity | |
import android.util.Log | |
import com.android.billingclient.api.* | |
import com.android.billingclient.api.BillingClient.BillingResponseCode | |
import com.android.billingclient.api.BillingClient.FeatureType | |
import dev.goodwin.BillingManager.Companion.formatPeriod | |
/** |
This file contains hidden or 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
<link rel="import" href="../bower_components/polymer/polymer.html"> | |
<link rel="import" href="../bower_components/core-ajax/core-ajax.html"> | |
<polymer-element name="my-element" noscript> | |
<template> | |
<span>I'm <b>my-element</b>. This is my Shadow DOM.</span> | |
<core-ajax url="http://example.com/json" auto response="{{resp}}"></core-ajax> | |
<textarea value="{{resp}}"></textarea> | |
</template> | |
</polymer-element> |
This file contains hidden or 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
public class Sample { | |
public static void main(String[] args) { | |
List<Integer> values = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9); | |
int result = 0; | |
for (int e : values) { | |
if (e > 3 && e % 2 == 0) { | |
result = e * 2; | |
break; | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="net.simplyadvanced.testandroidannotations" > | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" |
This file contains hidden or 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
// This is for API 15-17+ | |
// Tested on 4.0.3 | |
public class ActivityMain extends Activity { | |
ImageButton buttonTimeDone; | |
NumberPicker numberPickerAmPm; | |
TextView textViewTime; | |
TimePicker timePickerMain; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |