Skip to content

Instantly share code, notes, and snippets.

@bgits
bgits / UsernameRegistry_flat.sol
Created September 11, 2018 14:15
UsernameRegistry + related contracts
pragma solidity ^0.4.24;
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public;
}
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
margin = float(input("Enter the gross margin per customer: "))
churn = float(input("Enter the percentage of customers who end their relationship with a company in a given period: "))
discount = float(input("Enter the cost of capital used to discount future revenue from a customer(discount rate): "))
gc = float(input("Enter the yearly gross contribution per customer: "))
clv = (gc * margin) * ((1 - churn) / (1 + discount - (1 - churn)))
principal = float(input("Enter the lump sum investment: "))
apr = float(input("Enter the perodic interest rate: "))
years = int(input("Enter the number of periods: "))
x = years
for i in range(years):
principal = principal * (1+apr)
print('The value in %s periods is: %s' % (years,principal))
#!/usr/bin/env node
var fs = require('fs');
var outfile = "primes.txt";
var primes = new Array();
var i = 2;
var factor = function(n){
while (primes.length<100)
{
if (n%i !== 0 && i === n-1 ||n===2){
var primes = new Array();
var factor = function(n){
for (var i = 2; i === n-1; i++)
{
if (n%i !== 0 || n !== i){
primes.push(i);
}else{n = n-1;}
}
};