Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programming Challenge (Out-of-Date)
New Posts  All Forums:Forum Nav:

Programming Challenge (Out-of-Date) - Page 18  

Poll Results: Are you interested in participating in and/or helping organise and post these programming challenges?

 
  • 100% (2)
    I want to participate.
  • 0% (0)
    I want to contribute by helping posting and organise these challenges.
  • 0% (0)
    I'll only take part if other people are willing to participate.
  • 0% (0)
    I can help and participate - I love programming!
  • 0% (0)
    I do not wish to participate or help.
2 Total Votes  
post #171 of 306
Quote:
Originally Posted by xtascox View Post
Old job used AJAX in the most annoying places. New job we use it but I don't deal with the web stuff anymore. I write the core code and API that our web interface relies on.

LISP eh? I could give it a go...

I think my goal is going to make the program run for as long as possible while doing the 30 primes I just cannot fathom how to make it run for over 2 minutes.
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
post #172 of 306
Quote:
Originally Posted by Midpipps View Post
I think my goal is going to make the program run for as long as possible while doing the 30 primes I just cannot fathom how to make it run for over 2 minutes.
Write it in javascript and run it on a 386?
post #173 of 306
Quote:
Originally Posted by xtascox View Post
Write it in javascript and run it on a 386?
How inefficient can i make it while still having it do what it is supposed to. without extra steps like wait commands or anything that should be part of the challenge. You pick the language and I will duel you for inefficient code or closest to a 2 minute run time.
Edited by Midpipps - 1/5/11 at 11:10am
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
post #174 of 306
Quote:
Originally Posted by Midpipps View Post
How inefficient can i make it while still having it do what it is supposed to. without extra steps like wait commands or anything that should be part of the challenge. You pick the language and I will duel you for inefficient code or closest to a 2 minute run time.
How about a SQL procedure?
post #175 of 306
Quote:
Originally Posted by xtascox View Post
How about a SQL procedure?
I am up for it I suppose would not be my first choice but if that is what you want. I was more thinking along the lines of C++, C, Java, python, perl, VB, C#, Jscript, or some other standard language . But if you want SQL Procedure I am up.
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
post #176 of 306
Quote:
Originally Posted by Midpipps View Post
I am up for it I suppose would not be my first choice but if that is what you want. I was more thinking along the lines of C++, C, Java, python, perl, VB, C#, Jscript, or some other standard language . But if you want SQL Procedure I am up.
I was trying to think along the lines of something that would be a bad choice and inefficient for the job

Rules:
1.) Every line of code must have a purpose toward completing the task (e.g. no nonsense lines to take up time)
2.) Final run should be on the latest version of MySQL.
3.) Output will be a final SELECT statement.
Edited by xtascox - 1/5/11 at 11:58am
post #177 of 306
Edit[This is busted.. better solution on next page]

Didn't have time to do any cleanup. I'd probably have handled it a little bit different. Also, I don't stop on the first denominator.

This is scala 2.8

Code:
package test

import scala.collection.mutable.{MutableList => List}

class FindPrime {

def getNextPerin(inp:List[Int]):List[Int] = 
{
val out = inp(inp.length-3) + inp(inp.length-2)
return inp += out  
}

def primeList(k:Int):List[Int] = 
{
  var curr:Int = 3;
  var primeList:List[Int] = new List() += 2; 
  while(primeList.length != k)
   {
   if(isPrime(curr)) { 
    primeList += curr; 
    }
   
   curr+=1;
   }
   return primeList
}

def isPrime(curr:Int):Boolean = {

var start:Int = curr/2;
if(start == 1) {start = 2; }
while(start > 1)
{
if(curr % start == 0)
{
return false;
}
start -=1;
}

return true;

}



}

object FindPrime {
  
  def main(args : Array[String]) : Unit = {
 var fp =  new FindPrime();
 var primeList = fp.primeList(30);
 var perinList = new List() +=  3 += 0 += 2
 val max = primeList.reverse.head
 while(perinList.size != max+1)
 {
 fp.getNextPerin(perinList)
 }
 
 for(i <- primeList)
 {
 val matched: List[Int] =  perinList.filter(q => q != 0).filter(j => j >=  2 * i && j % i ==0 )
 if(matched.length > 0) { println(matched.head + " is divisible by " + i); }
 
 }
   
  }
}

Edited by impatient - 1/5/11 at 1:17pm
post #178 of 306
bah.. now i've solved the wrong problem.. not too horribly inefficient
post #179 of 306
Quote:
Originally Posted by xtascox View Post
I was trying to think along the lines of something that would be a bad choice and inefficient for the job

Rules:
1.) Every line of code must have a purpose toward completing the task (e.g. no nonsense lines to take up time)
2.) Final run should be on the latest version of MySQL.
3.) Output will be a final SELECT statement.
I agree to your terms and add 1 more has to be in by next Tuesday in case I don't get time tonight .

Quote:
Originally Posted by impatient View Post
bah.. now i've solved the wrong problem.. not too horribly inefficient
Your code looks good though now how inefficient can you make it in MySQL. Take you out of that scala comfort zone

and with that note I say
"To BATTLE"
Edited by Midpipps - 1/5/11 at 12:22pm
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
    
CPUMotherboardGraphicsRAM
Q6600 DG33TL XFX 6950 2GB 4gigs Corsair XMS2 DDR2 
Hard DriveOptical DriveOSMonitor
1.5TB seagate 2X640GB Samsung DVDRW Windows Vista & Debian Linux Samsung 19" + Acer 24" Wide 
KeyboardPowerCaseMouse
Microsoft SideWinder X6 Antec 750 TruePower Raidmax Smilodon COOLER MASTER Sentinel 
Mouse Pad
RocketFish 
  hide details  
post #180 of 306
Quote:
Originally Posted by Midpipps View Post
I agree to your terms and add 1 more has to be in by next Tuesday in case I don't get time tonight .


Your code looks good though now how inefficient can you make it in MySQL. Take you out of that scala comfort zone

and with that note I say
"To BATTLE"
It's on!
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
This thread is locked  
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programming Challenge (Out-of-Date)