Skip to content

Instantly share code, notes, and snippets.

@don1138
Last active November 7, 2023 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save don1138/185fe27e9c4a5a8a91f1ca7d55687878 to your computer and use it in GitHub Desktop.
Save don1138/185fe27e9c4a5a8a91f1ca7d55687878 to your computer and use it in GitHub Desktop.
Phi, Ascending, Descending, and Exponent; and the Chessboard Rice values
import bpy
from math import sqrt
phi = (1 + sqrt(5)) / 2
# phi = 5 ** .5 * .5 + .5
# ASCENDING
e1 = [round((x * phi),3) for x in range(1,17)]
print(f"\nAscending = {e1}")
# DESCENDING
e2 = [round((x * phi),3) for x in range(16,0,-1)]
print(f"\nDescending = {e2}")
# EXPONENTIAL
e3 = []
p = phi
for _ in range(1,17):
e3.append(round(p,3))
p = p * phi
print(f"\nExponential = {e3}")
# CHESSBOARD RICE
# It is believed that chess was invented some 1,500 years ago in India, and the game's inventor so impressed the emperor that he was asked to name his reward. A chessboard has 64 squares, and the inventor asked for one grain of rice on the first square and double that number for the next square and so on for all 64 squares.
# The emperor thought it was such insignificant compensation for so marvelous a game that he agreed only to find out that by the time the 64th square was reached, there was not enough rice in the kingdom to fulfill the request. One version of the legend claims the inventor was then beheaded.
# This script creates a List of how many grains of rice for each chessboard tile.
# Max = 9,223,372,036,854,775,808
e4 = []
r = 1
for _ in range(1,65):
e4.append(r)
r = r * 2
print(f"\nChessboard Rice = {e4}")
# OUTPUT:
# Ascending = [1.618, 3.236, 4.854, 6.472, 8.09, 9.708, 11.326, 12.944, 14.562, 16.18, 17.798, 19.416, 21.034, 22.652, 24.271, 25.889]
#
# Descending = [25.889, 24.271, 22.652, 21.034, 19.416, 17.798, 16.18, 14.562, 12.944, 11.326, 9.708, 8.09, 6.472, 4.854, 3.236, 1.618]
#
# Exponential = [1.618, 2.618, 4.236, 6.854, 11.09, 17.944, 29.034, 46.979, 76.013, 122.992, 199.005, 321.997, 521.002, 842.999, 1364.001, 2207.0]
#
# Chessboard Rice = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment