Saturday, December 26, 2009

Coding part 3

I realized that I should also include the assignment that I'm working on, since that's the true test of whether or not I'm actually producing what I'm supposed to be producing.


Problem 2:
Write a program that computes the sum of the logarithms of all the primes from 2 to some number n, and print out the sum of the logs of the primes, the number n, and the ratio of these two quantities. Test this for different values of n.

My code:

# Remember that log(x) is actually ln(x) (log base e)
a = []
a.append(2)
a.append(3)
i = 5
prime = 1
values = log(a[0]) + log(a[1])
n = eval(raw_input("Please enter N, the upper limit (greater than 3): "))
# Yes, this is weak sauce, but I'm not up for exception-handling at the moment
while i <= n:
for item in a:
if (i%item) == 0:
prime = 0
if prime == 1:
a.append(i)
values += log(i)
i += 2
prime = 1
print a
print "Sum of log of primes: ", values
print "N: ",n
print "Ratio of sum/n: ", (values/n)

Thoughts?

- Arpan

Adventures in Auto-Suggest (1/?)

Hmmm...




Hmmm...

- Arpan

Friday, December 25, 2009

Primes part deux

Um... haha...

I realized that my code was taking forever because I forgot one teensy little line... two, actually...

Revised below. Yay!

a = []
a.append(2)
a.append(3)
i = 5
prime = 1

while len(a) < 1000:
for item in a:
if (i%item) == 0:
prime = 0
if prime == 1:
a.append(i)
i += 2
prime = 1
print a

{Yes, I know the assignment calls for the 100th one specifically, but it's just the last element in the array. Deal with it, elitists.}

Hooah!

- Arpan

MIT OCW

So I've started this OCW business with MIT and it's intriguing. I'm taking the ground-level programming class and one of the first assignments is to use python to print the 1000th prime (it's 7917, btw). I thought, So I've started this OCW business with MIT and it's intriguing. I'm taking the ground-level programming class and one of the first assignments is to use python to print the 1000th prime (it's 7917, btw). I thought, Okay, I'm familiar with Python, but programming logic eludes me, so let's give this a shot.

My first code iteration went like this:

a = []
a.append(2)
a.append(3)
i = 1
j = 5
primestate = 1

while len(a) <= 1000:
if j%2 != 0:
temp = []
while i <= (j/2+1):
temp.append(j%i)
i += 1
for item in temp:
if temp[item] == 0:
primestate = 1
if primestate == 0:
a.append(j)
del temp
i = 1
j += 1
primestate = 1
print a

Then I thought to myself... WTH am I doing?? So, before I ran it to test, I changed the code to:

a = []
a.append(2)
a.append(3)
i = 5
prime = 1

while len(a) <= 1000:
for item in a:
if (i%item) == 0:
prime = 0
if prime == 1:
a.append(i)
i += 2

print a

which is (hopefully) way more efficient and logical. I'm running it right now - it's taking a while, which makes me think that this is in no way efficient or logical, but here's to hoping.

Perhaps some engineers can comment on ways to improve?

Thanks,

Arpan

Thursday, December 24, 2009

Spelling Enemy

I just read my last post and was horrified by some of the spelling mistakes. I hope to never repeat them. In other exciting news, I'm back in San Diego for winter holidays (read: WFH three days next week, then coming back the week of the 4th). That's three days to wrap up Q4 goals...

Crap.



Ah well... Christmas day tomorrow... I'm excited (forget Santa - the Chargers are playing!)

Also, I've decided that I'm going to really dedicate some time to exploring MIT's OCW - wish me luck.

- Arpan

Friday, November 13, 2009

I have moved!

Just an update - I've moved to the city (San Francisco) and it is great. I've only been up here for a week, but it's just so much cooler. When I first moved up, I had to pick up some minor furnishings, and on my way to the store, I saw/experience more general weirdness in that short period than I had in six months in Sunnyvale.

Anyways, that's part of what makes it great. I fully intent on taking some time this weekend to explore the city and spend some time outside of the apartment.

Good times ahead.

Cheers,

Arpan

Economist wins again


- Arpan

Saturday, October 17, 2009

It's that time of the year again...

No, not Christmas in July! It's time for us to pick our Rotations...

What this means is that coworkers become enemies; friends become enemies; brothers and sisters become... enemies.

Not really, but drama makes it better. The reality is that our groups are intracompedent (intra-competing-dependent). If we intend on leaving our current groups and continuing in the Rotation Program, it's in our best interest to pump it up so that others mark it as their top choice and the "pumper" has a greater chance if receiving his/her top pick.

But what if we don't plan on leaving our current group?

And this, folks, is where I find my conundrum. I've greatly enjoyed my experience on the Checkout Finance team, and if I were offered the opportunity to stay for the next rotation, I'd be very hard-pressed to say no; but, there's something about walking outside of the comfort zone to take on a 9-month experiment in a different group that I find compelling.

Let's take some risk, eh?


Cheers,

Arpan

Wednesday, September 23, 2009

I will be on this...

... list, someday. Of course, I could edit it now, but I won't. Give me ten years, and you'll see my name in at least three of the sections.


- Arpan

Monday, September 21, 2009

Apocalyptica

is awesome... that's all I got today.




Cheers,

Arpan

Saturday, September 19, 2009

Day 3.25

Found a place in the city (Bayside Village); J-dub and I applied, waiting to hear back. Move in is 10/14, so methinks I'll take a day off le Goog and get my movin' on. I'm really quite excited about getting out of the South Bay, so good times ahead.

Doing day 1 of Better Man today (building core values) - let's see how that goes. I want to make today productive, and also get some guitarring in (it's been too long, Betsy. I'm sorry).

Cheers,

Arpan

Wednesday, September 16, 2009

Day 1.5

It's tougher than I thought. Haven't even touched the Better Man stuff, though I'll blame that on moving from my place to my cousin's. I did learn a lesson though - badassery is a ongoing process. One can't be a badass without continuous contribution to the cause. It's probably too much to hope for daily badassness progress as of yet, so I'm scaling back to weekly.

Although, I will say, if I work out, rip through 10 reviews, put together metrics, and finish peer reviews by 7p tomorrow... that'd be pretty badass :)

- Arpan

Monday, September 14, 2009

Day 0

I started reading this ebook - 30 Days to a Better Man - on a lark, but it's actually quite interesting. It's less about machismo and more about character, integrity, and other essential traits that defined the men from the days of yore.

I like it.

In the spirit of the Better Man guide, I'm going to blog about my efforts to become a better badass, not merely a better man (though I'll keep a log of how I'm doing with the Better Man teachings too). Some of these efforts (and lessons learned) may be contradictory to the Better Man lessons, but that bridge will be burnt to the ground whenever I get to it.

I actually haven't yet done anything to today to increase my badass points, but when I update this later, hopefully I'll have a lesson to share.

Cheers,

Arpan

Wednesday, September 9, 2009

Welcome Back

'Lo. I'm back. I've realized that my inactivity on this blog was a result of my inability to find things interesting, but I've made a sincere vow, along with my good friends, to pursue an interesting life to the best of my ability. I shall post more regularly, if only because that'll be an 'interesting' endeavor ;)

I kid you not. I'll clean out this post with a quote, but expect a posting sometime in the near future.

A word to the wise ain't necessary - it's the stupid ones that need the advice. - Bill Cosby

Thursday, April 23, 2009

Better Off Ted = Win

http://abc.go.com/primetime/betteroffted/index?pn=index

Sunday, April 19, 2009

This is why

woot.com continues to be awesometastic.

(Reprinted without permission)

The Bangor night was like ink. Moonless. Cold. The young boy slowly awoke to the scratchings against his second story window. Scratchings and whispers.

Timmy… Timmy…

“What? Who? Who’s there?”

Timmy… it’s me… Billy…

“Billy? But… that accident in the ravine three days ago… they said you were dead!”

No, Timmy… I’m here… I want to play…

“Play? Billy, it’s four in the morning! And you’re hovering! And you’re wearing a black cape with a red silk lining and talking in a weird voice!”

Open the window, Timmy, so we can play! We can play forever now! I’ll teach you how! Just open the window!

“Billy… is this because I got that refurbished XBox?”

What? No, Timmy, it’s because you were always my best friend! It has nothing to do with all the fantastic games you can play or the twenty gig hard drive built in. We can just play cards or something if you don’t believe me. Open the window, Timmy! Open the window!

“Because, see, Greg was here just the other day.”

Greg? That kid in our class? Didn’t he die in that car wreck last July?

“Yeah, he’s apparently a zombie now. Came back and wanted me to let him in so we could play online with XBox Live. He said he was just trying to eat my little sister’s brains but he didn’t even ask me where her room was. Kept me up all night.”

Foolish Greg. A lord of the night such as I would never pass such an opportunity by.

“Yeah, Peter tried that line too.”

Peter? The boy who-

”-vanished in the forest in autumn? Turns out he got bit by a werewolf. He came over last full moon and said something about ‘the hunger’ and ‘sharing the rapturous cloak of the divine Selene’ but all we did was watch my dvds. They look great in 16:9 widescreen because the XBox supports up to 1080p high def and 480p standard but… I mean, I gotta go to school still and you guys are really imposing!”

Timmy, listen to me. The power of a lord of the night dwarfs any mere werewolf. I shall offer you the Dark Gift myself. We will share dominion over the-

”-mere humans who can’t appreciate the blah blah blah. Simon and Lucy Jenkins tried that last week. Remember them? They got sucked down a sewer and then bonded to an alien spider-thing covered in ooze. It was so gross, they got it all over the patio. And just last Friday some crazy high school girl said that if I let her play, she’d let me take her to the prom!”

Covered in blood?

“Yeah! You know her?”

Dude, she’s wild after a few drinks. You should have said yes.

“Really?

Okay, Timmy, look. I’m not gonna keep pretending that we were close when I was alive. But think about it. What happens if your refurbished XBox gets the Red Ring Of Death? Or the even stranger Red Light Of Death? Who’s gonna help you then? You’re gonna want someone like me, someone who can command the dead to do his bidding, someone who can raise it back into an admittedly unholy but perfectly useable mockery of life. So let me in, huh, pal?

“Billy, I’ll tell you what I told that mummy-priest made from the soul of Betty Jenkins on Tuesday. My XBox is covered with the optional SquareTrade warranty that I remembered to purchase separately at the time of checkout for an additional $19.99. That means if it fails during the warranty period, I don’t have to worry. So let me go back to sleep, okay? The swamp monster born of the fire that took the life of a vengeful Bobby Smith always shows up at dawn and I have a math test.”

Timmy. Timmy, wait! Just an hour, Timmy, that’s all I want! Just let me play a little bit! You won’t even know I’m here! Timmy! Timmy! Let me in, please, Timmy! Please!

“Man, I wish we’d never moved to Maine.”


Wednesday, April 15, 2009

Economist.com wins again

As the increasingly violent war for my soul progresses (between pornography and The Economist), I've come to realize there is no good reason why we can't all get along. That said, this post is about The Economist, and later posts may or may not be about porn.

This week's Economist.com articles are great, as always. I'd like to draw particular attention to:

http://www.economist.com/business/displaystory.cfm?story_id=13446612, which is potentially the way newspapers may be saved. If so, this could be a great win for WB (Warren Buffett, not Warner Bros.)

Also, its continued focus on Japanese business concepts - http://www.economist.com/business/management/displaystory.cfm?story_id=13480663

More to come later.

Enjoy,

Arpan

Friday, April 3, 2009

Apparently it is tradition for people who are joining the Checkout Finance team to do a sort of 'Welcome Dance'. To celebrate my arrival, I did this (sans partner). 


<

I want to say that I was like Will, but I think I was more Carlton. Nonetheless, I think it went well.

- Arpan

Tuesday, March 31, 2009

F is for...

How interesting: http://online.wsj.com/article/SB123852657881174747.html

Looks like Mr. Yu has a habit of CFO-ing companies that will never be profitable. Well done, sir.




- Arpan

Venture Me

Le Goog (my humble abode) had an interesting announcement yesterday. We've known about this internally for a little while, but the specifics eluded us (e.g. it's a $100mm fund). Nonetheless, my efforts over the next couple of years will be focused on joining this elite group of elitists and then raising the elitism bar.



Bonne chance (to myself),

- Arpan