Skip to content

Instantly share code, notes, and snippets.

# From u/42IsHoly:
# https://www.reddit.com/r/math/comments/nt4o10/a_pretty_cool_but_completely_useless_function_i/
#
# > we can define a “pseudo-base function” which we’ll call B. B(x) = Sum (xn *
# > nth digit of x) Where the ones digit is the 0th, the tens digit is the 1st,
# > the 1/10s digit the -1st the hundreds digit the 2nd, etc.
#
# This function assumes conversion from the decimal base, but we should be able to generalize that.
#
# Script by u/toppletwist. 2021, public domain.
@sebastianv89
sebastianv89 / balance.py
Last active August 11, 2020 17:51
Balancing numbers
import math
N = 10000000
def check_bm(n, r):
lhs = (n*(n-1))//2
rhs = n*r + (r*(r+1))//2
return lhs == rhs
def list_bm():
@sebastianv89
sebastianv89 / ringsign.pv
Created February 12, 2020 04:54
Testing
attacker[active]
principal Alice [
knows private a
ga = G^a
]
principal Bob [
knows private b
gb = G^b