Anonymous ID: 52f747 April 5, 2019, 12:05 a.m. No.9007   🗄️.is 🔗kun   >>9008 >>9010

Generating the Pell and Square Triangle sequence with the grid:

 

public static BigInteger zero = BigInteger.ZERO; public static BigInteger one = BigInteger.ONE; public static BigInteger two = BigInteger.valueOf(2); public static boolean gt(BigInteger i, BigInteger i2) { return i.compareTo(i2) 0; } public static boolean gteq(BigInteger i, BigInteger i2) { return i.compareTo(i2) >= 0; } public static boolean lt(BigInteger i, BigInteger i2) { return i.compareTo(i2) < 0; } public static void main(String[] args) { //generate Pell numbers starting with Pell(1) = 1 and Pell(3) = 5 //aka (1, 1, 1) BigInteger a = one; BigInteger b = BigInteger.valueOf(5); BigInteger c = a.multiply(b); BigInteger d = sqrt(c); BigInteger f = two.multiply(d); BigInteger n = a; BigInteger x = d.subtract(a); BigInteger _2n_p_x = two.multiply(n).add(x); BigInteger i = d.add(n); BigInteger j = x.add(n); BigInteger square_triangle = a.multiply(x).pow(2); BigInteger square_triangle2 = d.multiply(_2n_p_x).pow(2); for (int iter = 0; iter <= 64; iter++) { / a and d is the Pell sequence / System.out.println(a); System.out.println(d); //System.out.println(x); //System.out.println(_2n_p_x); //System.out.println(c); //System.out.println(f); //System.out.println(i); //System.out.println(j); //System.out.println(square_triangle); //System.out.println(square_triangle2); a = b; n = a; d = two.multiply(b).add(d); b = two.multiply(d).add(a); c = a.multiply(b); f = two.multiply(d); / x and 2n + x are the sequence of b values for the square triangle sequence / x = d.subtract(a); _2n_p_x = two.multiply(n).add(x); / ax and d(2n+x) is the square triangular number sequence / square_triangle = a.multiply(x).pow(2); square_triangle2 = d.multiply(_2n_p_x).pow(2); i = d.add(n); j = x.add(n); } } public static BigInteger sqrt(BigInteger n) { if (n.equals(zero)) return zero; if (gt(n, zero)) { int bitLength = n.bitLength(); //ceil(log(n, 2)) BigInteger root = one.shiftLeft(bitLength >> 1); //right-shifting by one equals dividing by two while (!isSqrt(n, root)) { root = root.add(n.divide(root)); root = root.shiftRight(1); } return root; } throw new ArithmeticException("Complex result"); } public static boolean isSqrt(BigInteger n, BigInteger root) { BigInteger lowerBound = root.multiply(root); / Bitcode compiler will optimize this statement / BigInteger upperBound = root.add(one).multiply(root.add(one)); return gteq(n, lowerBound) && lt(n, upperBound); }

Anonymous ID: 52f747 April 5, 2019, 12:09 a.m. No.9008   🗄️.is 🔗kun

>>9007

The grid entry movement:

{1:1:2:1:1:5} (1, 1, 1){1:5:12:7:5:29} (1, 5, 4){1:29:70:41:29:169} (1, 29, 21){1:169:408:239:169:985} (1, 169, 120){1:985:2378:1393:985:5741} (1, 985, 697){1:5741:13860:8119:5741:33461} (1, 5741, 4060){1:33461:80782:47321:33461:195025} (1, 33461, 23661){1:195025:470832:275807:195025:1136689} (1, 195025, 137904){1:1136689:2744210:1607521:1136689:6625109} (1, 1136689, 803761){1:6625109:15994428:9369319:6625109:38613965} (1, 6625109, 4684660){1:38613965:93222358:54608393:38613965:225058681} (1, 38613965, 27304197){1:225058681:543339720:318281039:225058681:1311738121} (1, 225058681, 159140520){1:1311738121:3166815962:1855077841:1311738121:7645370045} (1, 1311738121, 927538921)