Find Me Online

I’ve been testing some prime numbers out with the factors function. I tested this Cullen prime: 393050634124102232869567034555427371542904833 and gave it about 21 hours with one core dedicated to it but it never came back.

I tested this Carol prime: 4398042316799 and almost instantly I received:

CL-USER> (factors 4398042316799)
(1 4398042316799)

Right now I’m testing this Fibonacci prime: 99194853094755497. Its been going about 20 minutes now with a core dedicated to it, but its not done yet. Certainly the algorithm could be faster, it wasn’t really meant for what I’m having it do now…so these are just tests “for personal interest”.

Here is a really simple function to test for prime-ness. I actually didn’t test it since currently the REPL is tied up with that Fibonacci prime, but it looks like it ought to work…

EDIT: In under 30 minutes (I didn’t see exactly when it happened) the REPL came back with:

CL-USER> (factors 99194853094755497)
(1 99194853094755497)

I also tested the function and it looks pretty good from my simple tests.

I’ve been learning Lisp for several months now, but this summer I decided to really buckle down and put some effort into it. I definitely like Lisp, and I don’t feel like I even know very much of it. It feels very clean to me; it almost feels more like doing math than programming. I haven’t gotten too far with doing AI in Lisp yet, because I’ve spent most of my time getting to know the language. Things like defun, let, do, dolist, dotimes seem pretty standard for a language, just with different names.

However, things like lambda and defmacro really opened my mind up! These concepts were so different from anything I knew previously that for a while after I read them I though “Man, no one would ever use these because there are better ways to do the things these can do.” What was exciting was when I realized how I didn’t fully grasp their capabilities, and suddenly was able to imagine new things I could do with the power of lambda and especially defmacro.

I’m thinking of a couple projects to do. One of them came out of the Paradigms of Artificial Intelligence Programming book I have. The other one I came up with on my own. My idea is to have a “dungeon solver” where there is a map in some data structure (most likely a list, but we’ll see) that contains zeros for open space, ones for walls, and a goal. Initially I think I’ll just have a little guy randomly walking around the dungeon looking for the goal. Later I may add some more intelligence to the system, such as not going back to places already been unless necessary.

Below I’ve got some code I wrote that deals with finding all the factors of a number and also determining if two numbers are coprimes. Lastly there is a function that finds primes up to a given number you supply. It is not the fastest way to do it, but since I had the factors function already it was so tempting to write the find-primes function that I just went ahead and did it. Thanks, thanks, thanks to Jon Rowe for helping me learn Lisp. Hes awesome, I highly recommend him if you’re looking for a tutor. Alright, heres the code (check the end of the post for a neatly formatted file)!

I like design quite a bit, but I think even more I like looking at other people’s design work. Below are the sites I frequently use for design ideas/inspiration.

#4 Pixel Groovy
This site is in the social news style, most similarly modeled after Digg. The site doesn’t get new top stories as frequently as Digg, but there are lots of great old articles to look through. What’s great about this site is that stories/tutorials/downloads concerning design don’t age quickly. For this reason, Pixel Groovy is a great repository, because you know at least one, and generally more people, have “grooved” a story.

#3 CSS Remix
This site is full of sites with nifty features that make you make you wish you could include them on your own site. CSS Remix has a pretty great layout with a rating system that allows you to slice up their data on sites in lots of useful ways. If you’re running low on web design ideas I’d definitely check out CSS Remix for some fresh inspiration.

#2 Brusheezy / Vecteezy / Fresheezy
I’m not sure of the relationship between these sites, but all of them offer some really excellent free stuff. Brusheezy offers both brushes and patterns for free download. Vecteezy offers free vector graphics, and I must say most of them are very excellent. The graphics are nearly all modern, stylish design and a lot of design firms have sample packs released there. Fresheezy offers free themes for WordPress, PHPBb and lots of other popular web software. The designs are generally pretty good, though this particular “-eezy” site has a more limited focus to people who use the software they support.

#1 BittBox
BittBox is a great site and is set aside from the rest because the creator of the site generates nearly all of the content featured on it. The stories and downloads offered are available first on BittBox and they are all very high quality. The creator has tutorials and vector downloads frequently so there is usually a nice surprise whenever you go visit.

That’s it for my Design Site Roundup! If you’ve got great sites like these please leave them in the comments.

Last semester I had a class entitled “Music Composition With Computers”. The class was very different from what I expected, and we focused entirely on Art Music, rather than how to use computers to compose more conventional music. Art music is definitely a different experience than any other music I’ve listened to, and you should check it out (though keep an open mind!).

Our final project was to create a piece that was five to seven minutes long. It was a very non specific assignment; we didn’t even have to use computers for the project. I did use them and I wrote a program that would do all of the composing and the sound making for me. When you run the program what you’ll see are a bunch of different colored dots on the screen that represent music playing entities. They will move around and play their instruments for generally as long as you let the program run (though they do sometimes all die out). I suggest running the program multiple times, because each time you’re likely to get something that sounds very different from the last. For more details on conceptual level operations of the program, check the program notes which are included in the download at the end of this post.

That program is musicLife. It consists of five classes: Entity, Neuron, pocket, Project9, and SoundMaker. It is a Java Applet and you’ve find the source at the end of this article. Each class does the following:

Project9: This is the class that’s run, and gets everything else running. It handles the visual output and the reproduction/killing off of the entities.

Entity: Each entity has “brain” which is a two dimensional array of neurons. The Entity manages the neurons by prompting them to fire and passing them input from the environment and passing the environment input from them. Also, each Entity has two instruments which are selected from the midi catalog on the computer its running on. Depending on the out put from the neurons, the Entity will play or not play its instrument. The Entity’s movement about the screen is also determined from neuron output. Lastly, if the Entity is passed an Entity during construction bases its own brain on the brain of the Entity it was passed. In this manner there is a parental lineage that forms that allows the evolutionary aspect of the program to work.

Neuron: Each neuron is generated with an algebraic operator (+, -, /, *), a number that will be used with that operator when data is passed in, and four links to other Neurons in the Entity’s brain. The neuron takes in information, uses its operator and number on it, then passes the info out to the Entity (in a “pocket”) and the Entity handles letting the other Neurons know they have data to accept.

pocket: This is a really simple class that shouldn’t even exist, but for some reason I made it and once I used it in the code I didn’t see it being too necessary to change it. It just holds two objects, and thats really all it does.

SoundMaker: This class accepts the number of the midi instrument to be played and the pitch to play it at. There are only the population limit number of SoundMaker classes, and they are reused after an Entity dies because midi synthesizers get very expensive resource-wise when you’ve got upwards of 20 going at once.

To get the program running compile everything and use whatever tool you normally use to run Java Applets. I used TextPad, its really easy to use. Included along with the source is the Program Note I created when for when the piece was to be played. I thought the piece’s name was self referential and clever: A Truth: No piece has ever been given a name with this meaning.

I created this quick licence that, by downloading this file you are signifying you agree to:

By downloading this you agree to the following:

1. You may modify these files any way you wish, and you may even
use them as your own. However,

2. Any feature modifications you make you must inform me of. You
don’t have to provide the code (though you can), but you must
provide the conceptual details for the modifications you’ve made.