Jump to content

The Sanctuary


Rubrica
 Share

Recommended Posts

My 360 RRoD'ed...

Get a Ps3 :lol:

Hey! This is the Sanctuary - no baiting fanboy wars in the Sanctuary. :P

On that note, a friend of mine is now on his fourth PS3. His first one lasted a couple years, then it got the Yellow-Light-of-Death. He sent it out for service, got back a completely different PS3, and that one lasted for about two weeks. Furious, he sent that one back, got a third one from Sony - dead out of the box.

Don't get me wrong, I'm a Sony fanboy if anything, and I'd take the PS3 over the 360 any day, but the infallible PS3 myth is just as much a myth as Apple's "It just works" mantra.

Happiness:

I don't really have one right now, I'm just responding to things. ;)

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

Wan't meant as fanboy bait. Just a joke.

I got that from your :lol: , just like my :wink: meant I wasn't wholly serious either. But you know how sensitive fanboys are, so I had to jump in there. ;)

Edit: Btw I love your sig. MGS pun amirite?

Yep. It's a take off of the Subsistence disc of the Metal Gear Solid Essential Collection. Thanks. :)

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

F# is cool!

open System
open System.Diagnostics

let rec primeFactors x =
   let mutable i = uint64 (float x**0.5)
   while x%i0uL&&i>2uL do
       i    if i>1uL&&x%i=0uL then (primeFactors i) @ (primeFactors (x/i))
   else [x]

let toHistogram (x:uint64 list) = 
   let arr = Array.zeroCreate (int (List.max(x))+1)
   for i in x do
       arr.[int i]    arr

let toSingle (x:int array) = 
   let mutable v = 1.0
   for i = 0 to x.Length - 1 do 
       v    v

let input = UInt64.Parse(Console.ReadLine())
let stopwatch = new Stopwatch();
stopwatch.Start();

let finalfactors:int array = Array.zeroCreate(int(input)+1);
for divisor in int 2..int input do
   let factors =
       divisor
       |>uint64
       |>primeFactors
       |>toHistogram
   for i = 0 to factors.Length - 1 do
       finalfactors.[i]int)
let value = 
   finalfactors
   |>toSingle

stopwatch.Stop();
printfn "got %A" value
printfn "in %A ms" stopwatch.ElapsedMilliseconds

Console.ReadKey()|>ignore

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

@Pyrochild: That seems interesting. Makes me want to know what it does (is it a stopwatch?)

No, it calculates the least common multiple of the integers from 1 to whatever you specify. For example, 2520 is the smallest number that can be divided by each of the numbers from 1 to 10. The stopwatch is to test the speed of it.

I wrote it for Project Euler, which is by far the best way to learn a functional programing language.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...