Number Words an Analysis

FiveThirtyEight has a great quiz about Number words here . I thought this was really interesting and so had a think about it and started to generalize. I realized that as numbers grew the alphanumeric value would diminish in comparison, so I stopped just before one million. I threw some logic into Python and generated a dataset with I put into Qlik Sense for analysis. Here is what I found

Max alphanumeric value is 730, this is for 777,777. This is not a surprise as 7 has the highest alphanumeric value in the one through 9 integers

Here is the full distribution

Obviously as we start to add integers there is a jump as we have more words, max alphanumeric value for integers under 100k, 6 digits in the iteger, is 591. Under 10k the largest alphanumeric value is 481. You can see fairly steady growth of number of digits in the integer and the average alphanumeric value for that group of integers.

Starting with our overall maximum alphanumeric value we should only look at integers below 1000 to see a reasonably close relationship between integer values and their alphanumeric values. The largest alphanumeric value under 1000 is 314, so lets look at all integers below 350

I will post the answer after 538 does, but for now you can explore the below logic.

Description of below is basically all integers or alphanumerics have a distinct number of possibilities. In fact for all numbers below one million there are only 30 distinct alphanumerics. There are represented in the lists below.

You have distinct names for each number one through nineteen. 1 = one, 17 = seventeen.

Then for two digit numbers you can combine the names of the 10x numbers with alphanumeric value for one through nine and a zero length string for zero. 21 = twenty + one, 50 = fifty + “”.

Hundreds and thousands operate the same way and in conjunction with the above. Logic is below

Description of below logic is basically all integers or alphanumerics have a distinct number of possibilities.

You have distinct names for each number one through nineteen. 1 = one, 17 = seventeen.

Then for two digit numbers you can combine the names of the 10x numbers with alphanumeric value for one through nine and a zero length string for zero. 21 = twenty + one, 50 = fifty + “”.

Hundreds and thousands operate the same way and in conjunction with the above. Logic is below.

If you are good at python and can make this quicker we could add millions, I think multiprocessing or vectorizing in pandas would both be good options!

#Python Code
small = {0:'',1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen'}
tens = {2:'twenty', 3:'thirty', 4:'forty', 5:'fifty', 6:'sixty', 7:'seventy', 8:'eighty', 9:'ninety'}
e = {2:'hundred',3:'thousand'}

map = {'z':26,'y':25,'x':24,'w':23,'v':22,'u':21,'t':20,'s':19,'r':18,'q':17,'p':16,'o':15,'n':14,'m':13,'l':12,'k':11,'j':10,'i':9,'h':8,'g':7,'f':6,'e':5,'d':4,'c':3,'b':2,'a':1}

#thousand
def thou(n):
  tnum = n[:-3]
  tdig = len(tnum)
  if tdig == 1:
    twrd = small[int(tnum)]+e[3]
  elif tdig == 2:
    twrd = r2(tnum)+e[3]
  elif tdig == 3:
    twrd = hun(tnum)+r2(tnum)+e[3]
  else:
    twrd = ''
  return twrd

#hundred
def hun(n):
  if len(n) > 2:
    hnum = int(n[-3:-2])
    if hnum == 0:
      hundred=''
    else:
      hundred=e[2]
    hwrd = small[hnum]+hundred
  else:
  	hwrd = ''
  return hwrd
  
#right 2
def r2(n):
  rnum = int(n[-2:])
  if rnum == 0:
  	rwrd = ''
  elif rnum < 20:
    rwrd = small[rnum]
  else:
    rwrd = tens[int(list(str(rnum))[0])]+small[int(list(str(rnum))[1])]
  return rwrd

def word(n):
  n = str(n)
  return thou(n)+hun(n)+r2(n)

def wrdsum(n):
  wrd = word(n)
  return [n,wrd,sum([map[x] for x in wrd])]

def wrdlist(n):
  a=[]
  for i in range(1,n):
    a.append(wrdsum(i))
  return a

High availability

On the cheap

This page is hosted on an Amazon’s Elastic Cloud Compute EC2.  The instance is a small, but fixed slice of an Amazon server running a Virtual Machine described below.

The operating system is Linux.  Securely connecting to the machine allows me to install Apache as a web server, MySQL as a database and WordPress as a content management system.  There publicly available images with these pre-installed but I prefer to build my own.  Instructions here.

If you are unfamiliar with these technologies, check them out just at a high level.  Operating system is the computer’s basic functionality.  A web server receives and directs web traffic.  A database reads and writes information to be stored and accessed.  A content management system basically allows people to easily manage a blog. Continue reading “High availability”

What’s On Tap

What we can do

We can create a full wordpress site, with exact functionality of a WordPress Blog.  If you’ve never used WordPress, don’t worry!

It’s super easy, you can check out my sample site artefakt.es

Mine is minimalist but you can let your creativity flow with all of the design features of WordPress

You have the ability to make posts, link content, post pictures, seamlessly link to your Instagram, Facebook or Yelp pages,

Customers can create accounts so they can leave comments or see a history of their purchases

This is all fully manageable from the Admin screen accessible anywhere you have an internet connection

Continue reading “What’s On Tap”

Starting out

My goal is simply to create a site that demonstrates a service I wish to provide.  I want to be able to quickly and inexpensively create a content space for others.  The goal is to allow a friend, acquaintance, student or neighbor to seamlessly create and maintain an web page.  This process should be simple, secure, educational and maybe a little bit of fun

I want people to use this to communicate with others, as a creative outlet, as a means to sell their wares

For our entrepreneurial minded I want to offer secure payment methods such as PayPal and Square online payments.  This should all be manageable by a user with any technological background.

It will be safe and secure with full SSL encryption.  Data stored on servers will be encrypted with 256-bit AES encryption.  We should have the option to make our site highly available, fault tolerant, fast or bare bones

With the power of AWS and WordPress we can really get a lot of work done fairly quickly.  We can make use of out of the box extensions and applications with the click of a button

I’ll be demonstrating a few of the options I want to make available and from there it’s up to you