Live Taping: Here We Are Podcast

Please come to the Dead Crow Comedy Room on September 3rd at 3PM (doors open at 2:30PM) to see me take part in comedian and seeker Shane Mauss’s latest experiment, a series of live podcasts “featuring UNCW scientists and specialists from different fields discussing how we are what we are”:

Live Taping: Here We Are Podcast

When:
September 3, 2016
3:00 PM
Location:
265 North Front Street
Wilmington, NC 28401

I am not a specialist of anything. Even less a scientist.

I guess Shane Mauss isn’t a specialist either, though: In addition to hosting these podcasts about life, he does stand-up about hallucinogens, stars in a Netflix special called “Mating Season”, guests on Jimmy Kimmel’s show, Comedy Central, and Showtime, and in every case is ranging over a whole weird untethered range of subjects…and specialists. Just listened to podcasts he did with botanists, security experts, and happiness researchers.

UNCW brain guy and buddy Julian Keith put Shane onto me, after taking part himself in a great (!) live session on psychology. Thinking we might get into artificial intelligence, which I know the tiniest bit about and play around with, various tech topics I’m now trying to reacquaint myself with.

gears

Tech talk on cognitive applications

I’m giving a tech talk on cognitive application development this coming Tuesday:

“Applied artificial intelligence”: Getting started with cognitive application development

It’s meant to be a part of a set of talks we started last year on artificial intelligence—how do you actually begin to use these cognitive services in web apps, mobile apps—and it’s aimed at beginners and near-beginners.

The pictures below are my effort to frame the demo: Just as we know now that the brain is not a single, thinking organ but a choreographed set of cognitive skills, Watson is not a single “artificial intelligence” but a set of computational services. Which means that now, the way that Watson is presented and interacted with and marketed is more accurate: The cognitive services available in the Watson Developer Cloud are what it always was!

Anyway, it’s Tuesday, August 16th, 12 to 1 at tekMountain.com. I’ll post slides here, notes, a video if it’s made.

braincap

watsoncap

Playing with simple encryption math in Python

Probably every real programmer absorbed this decades ago in CS101. I learned it from an episode of NOVA I watched with my son last night, “The Rise of the Hackers“: The basis for most public/private key encryption, which we use for practically all internet data privacy these days, is a simple mathematical fact discovered (I think) by the RSA mathematicians:

It’s really, really hard to find the factors of a semi-prime, the product of two prime numbers. That is, it’s easy to multiply two primes together but hard to reverse engineer, such as you need to do when you hack encryption keys. Computers can start trying to compute the factors of a large semi-prime, but it will take them a long time—”thousands of computers millions of years” for the types of semi-primes we’re talking about. Factorable factors like 20000 x 350400, easy. Primes as factors, like 547 x 953, computationally too intensive for hackers, even with the latest hardware. So the semi-prime becomes the public key and its factors the private keys.

This fact seemed so irresistible and elegant to me (a teachable moment for my son! Something I could dust the old Python off for) that I got my laptop out and, as we watched the segment on quantum cryptography, created a little test program:

import time
def factor(sp):
    start = time.time()
    for p1 in range(1,sp):
        for p2 in range(1, sp):
            if p1 * p2 == sp:
                print "factors:", p1, p2
    print "time:", time.time() - start, '\n'

factor(15)
factor(15*71)
factor(229*101)
factor(307*89)
# factor(487*691)
# factor(997*991)
factor(900*200)

So the factor function uses nested loops to compute the factors of a given number, and it uses the time module to figure out how long each computation takes from start to finish. There are better ways to do this function, like with reduce code or using set to remove x/y y/x dupes, but it works and it’s legible. The bottom part tests the function by supplying semi-primes (via multiplication, so factor(229*101) is equivalent to factor(23129) because of the rules of precedence) and other numbers, and prints the resulting times.

Check it out! (I put the results below.) When you start getting into the semi-primes, it can thousands of times longer to factor, and these are low numbers. I commented out the 487*691 and 997*991 tests because they wouldn’t complete after like 10 minutes!

It’s so great to see mathematical principles applied in this way, to see the simple origins of complex systems like cryptography, and to noodle with code to get how things are working.

"""
factors: 3 5
factors: 5 3
time: 0.0390000343323 

factors: 3 355
factors: 5 213
factors: 15 71
factors: 71 15
factors: 213 5
factors: 355 3
time: 0.213999986649 

factors: 101 229
factors: 229 101
time: 65.7490000725 

factors: 89 307
factors: 307 89
time: 81.3059999943 

factors: 2 90000
factors: 3 60000
factors: 4 45000
factors: 5 36000
factors: 6 30000
factors: 8 22500
factors: 9 20000
factors: 10 18000
factors: 12 15000
factors: 15
etc etc
"""