## Search found 32 matches

Thu Feb 17, 2011 2:28 pm UTC
Forum: Computer Science
Topic: Sudoku solving complexity
Replies: 12
Views: 6173

### Re: Sudoku solving complexity

Hmm, determining whether it has a solution is the same as determining whether it is a valid puzzle in this case right? Because if it has no solution then I would assume it's not a valid sudoku puzzle. At the same time I would assume that every valid puzzle has only one valid solution right?
Tue Feb 15, 2011 2:02 am UTC
Forum: Computer Science
Topic: Sudoku solving complexity
Replies: 12
Views: 6173

### Re: Sudoku solving complexity

From looking at the solutions it looks NP-Complete, but I'm sure I'd have one hell of a time coming up with a proof, but I don't think the solution is very trivial at all. My solution looks like O(n^2) in the worst case, though I feel like it could be simplified to a more or less linear time complex...
Mon Feb 14, 2011 5:17 pm UTC
Forum: Computer Science
Topic: Sudoku solving complexity
Replies: 12
Views: 6173

### Sudoku solving complexity

I have an assignment in an AI class to create a sudoku solving algorithm, and it got me wondering about the complexity of solving a game. I'm not asking for help with the algorithm, but I would like to see what different approaches there are to solving it. The only solution I've thought of without l...
Tue Sep 07, 2010 2:58 pm UTC
Forum: Coding
Topic: CPU Affinity in Mac OSX
Replies: 4
Views: 4263

### Re: CPU Affinity in Mac OSX

Yes I worked that out last night. Still haven't figured out how to set the affinity but whatever at this point it's too late, and if I do bother I'll do it some other day.
Tue Sep 07, 2010 12:36 am UTC
Forum: Coding
Topic: CPU Affinity in Mac OSX
Replies: 4
Views: 4263

### Re: CPU Affinity in Mac OSX

I tried it like that and it didn't say it didn't recognize the command however it says there is a syntax error near unexpected token '1' I don't know what else to try but I'll take a look at that library, unfortunately I am pressed for time so if anyone knows a quick solution I would much appreciate...
Mon Sep 06, 2010 11:06 pm UTC
Forum: Coding
Topic: CPU Affinity in Mac OSX
Replies: 4
Views: 4263

### CPU Affinity in Mac OSX

Hi all, is there any way to set CPU affinity for a process from the terminal in OSX? I am looking for something similar to taskset in Linux. I am running Snow Leopard btw. Something like this: taskset 01 mysillyprocess Or if anyone has another method for assigning a specific CPU or CPU's to a proces...
Thu May 13, 2010 9:18 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### Re: A few quick questions for the brilliant minds of XKCD Fo

I think I meant specifically C#, Java, and other forced OO languages. Not necessarily Python, which I agree is way more simple, you might as well be writing pseudocode that compiles. However I wasn't in the mood for Python because I don't know it well enough to do things like that, even though I'm c...
Thu May 13, 2010 8:15 pm UTC
Forum: Coding
Topic: Programs that print their own source code
Replies: 100
Views: 25906

### Re: Programs that print their own source code

If anyone writes a quine in Brainfuck they win the internet. Shouldn't be impossible considering it's basically a language for writing Turing Machines.

Another one that would surely yield hilarity is LOLCODE.
Thu May 13, 2010 7:53 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### Re: A few quick questions for the brilliant minds of XKCD Fo

Thanks, I don't know a damned thing about C++ (in case it wasn't obvious :P) so I just used what I remembered from classes I took which required we use C++, I'm not a big fan of the language but it was the only one simple enough to program what I wanted yesterday at 3 A.M. without getting into tryin...
Thu May 13, 2010 7:21 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### Re: A few quick questions for the brilliant minds of XKCD Fo

Here's the code now, if anyone is interested in my shenanigans. I didn't implement the dynamic programming bit about finding all the primes I need to test bigger primes with, because frankly while it would help with much larger numbers, I don't need it up to 20! It only takes two minutes. Either way...
Thu May 13, 2010 7:04 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### Re: A few quick questions for the brilliant minds of XKCD Fo

Ok guys new problem, to use sqrt() I must declare a long long double or something similar, but then I'd be losing a whole buttload of digits to calculate with, so while it will speed up the algorithm, it's going to limit the size of the primes I can calculate for down to whatever a long long double ...
Thu May 13, 2010 5:32 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### Re: A few quick questions for the brilliant minds of XKCD Fo

Your test for numbers being prime is about the least efficient you could think of. You should consider it a puzzle, try to think of a way how it could be more efficient. You only need to check whether a number is divisible by smaller prime numbers, and only those that are less than the square root ...
Thu May 13, 2010 5:29 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### Re: A few quick questions for the brilliant minds of XKCD Fo

D.B. wrote:To test for primes you only need to examine values of x between two and the square root of y (as any factors must come in pairs, one of which is certain to be equal to or less than said square root).

Thanks, I don't know why I didn't think of that, should speed things up significantly.
Thu May 13, 2010 4:37 pm UTC
Forum: Coding
Topic: A few quick questions for brilliant minds [prime testing]
Replies: 16
Views: 3573

### A few quick questions for brilliant minds [prime testing]

Hey all I wrote a program in C++ that tests for factorial primes, this is just to keep me from getting bored really, I'm quite an amateur. Anyway I made a little primality testing algorithm that I calculate is about (3n) (in this case n being y): bool primetest(unsigned long int y) { for(unsigned lo...
Fri Apr 02, 2010 12:47 am UTC
Forum: General
Topic: XKCD april fools - Unixkcd Interface (mega-merge)
Replies: 76
Views: 14983

### Re: no "sudo get me a sandwich" in the CLI? seriously, Randa

guest@xkcd:/\$ man next
Request confirmed; you will be reincarnated as a man next.

guest@xkcd:/\$ man last
Man, last night was AWESOME.
Fri Apr 02, 2010 12:18 am UTC
Forum: General
Topic: XKCD april fools - Unixkcd Interface (mega-merge)
Replies: 76
Views: 14983

### Re: no "sudo get me a sandwich" in the CLI? seriously, Randa

They're adding more, because I tried echo a little bit ago and it did nothing.
Fri Apr 02, 2010 12:13 am UTC
Forum: General
Topic: XKCD april fools - Unixkcd Interface (mega-merge)
Replies: 76
Views: 14983

### Re: no "sudo get me a sandwich" in the CLI? seriously, Randa

I actually made a bash script on my mac where if you type in "make me a sandwich" it replies accordingly.

Also clear works just tried.
Fri Apr 02, 2010 12:01 am UTC
Forum: General
Topic: XKCD april fools - Unixkcd Interface (mega-merge)
Replies: 76
Views: 14983

### Re: no "sudo get me a sandwich" in the CLI? seriously, Randa

Yeah first thing I tried was rm too, and it worked for welcome.txt so I didn't do it anymore. A few others that echo different things: guest@xkcd:/\$ date March 32nd guest@xkcd:/\$ whoami You are Richard Stallman. guest@xkcd:/\$ look You are at a computer using unixkcd. Exits: west, south guest@xkcd:/\$...
Thu Apr 01, 2010 11:23 pm UTC
Forum: Coding
Topic: javascript Codes for April Fools
Replies: 11
Views: 7287

### Re: April Fool's Code

You could try executing a few different things, see what's already covered, for example I tried "emacs" and it returned "you should really use vim." Same thing goes for typing "vim" but doesn't do anything for pico.
Fri Sep 18, 2009 2:34 am UTC
Forum: Coding
Replies: 8
Views: 4488

### Re: Radix sort C/C++ help

Alrighty I figured that since that's all sorted (pun intended) I may as well share my source for any future homework makers in need of help. #include <iostream> #include <vector> #include <math.h> using namespace std; void printSorted(int x[], int length); vector < vector <int> > buckets; void radix...
Thu Sep 17, 2009 11:03 pm UTC
Forum: Coding
Replies: 8
Views: 4488

### Re: Radix sort C/C++ help

Pesto wrote:You can use integer division and the modulus operator to get at a specific digit pretty easily.

Thanks don't know why I didn't think of this.
Thu Sep 17, 2009 9:42 pm UTC
Forum: Coding
Replies: 8
Views: 4488

Hello guys, So I'm having a bit of trouble with a small homework assignment. The teacher has asked me to implement a radix sort algorithm in C or C++ that can sort an array of random numbers. My problem basically is I haven't coded in C in a while and I can not for the life of me remember how to ref...
Thu May 14, 2009 6:16 am UTC
Forum: Mathematics
Topic: Bernoulli's principle, toriccelli's law halp!!! :'(
Replies: 8
Views: 1628

### Re: Bernoulli's principle, toriccelli's law halp!!! :'(

Wait a second. http://en.wikipedia.org/wiki/Torricelli's_Law doesn't say anything about a linear relationship. It's essentially a reaffirmation of the law of conservation of energy... if a drop of water falls through a tank of other drops, it comes out with the same energy it would have if it had j...
Thu May 14, 2009 12:33 am UTC
Forum: Mathematics
Topic: Bernoulli's principle, toriccelli's law halp!!! :'(
Replies: 8
Views: 1628

### Re: Bernoulli's principle, toriccelli's law halp!!! :'(

It's probably easiest to think of this in terms of pressure and flux. In particular, the pressure on an infinitely thin layer of fluid at the opening is proportional to the weight of the entire column of of fluid directly above it. I think the differential equation follows rather obviously from thi...
Thu May 14, 2009 12:24 am UTC
Forum: Mathematics
Topic: Bernoulli's principle, toriccelli's law halp!!! :'(
Replies: 8
Views: 1628

### Re: Bernoulli's principle, toriccelli's law halp!!! :'(

Good god you make that look easy. Thanks guys.
Wed May 13, 2009 10:19 pm UTC
Forum: Music
Topic: What are you listening to?
Replies: 9560
Views: 1158137

### Re: What are you listening to?

m83 - Kim & Jessie
Wed May 13, 2009 10:15 pm UTC
Forum: Mathematics
Topic: Math Books
Replies: 379
Views: 270051

### Re: Math Books

Looking for a book on differential equations that specifically describes Bernoulli's principle and Torricelli's law.
Wed May 13, 2009 10:03 pm UTC
Forum: Mathematics
Topic: Bernoulli's principle, toriccelli's law halp!!! :'(
Replies: 8
Views: 1628

### Bernoulli's principle, toriccelli's law halp!!! :'(

Hello friends of XKCD, I need some help with a project for school. I'm not sure this is the correct place to put it as it can fall into the realm of either physics or applied mathematics. I am studying differential equations and need some help explaining a little project I have. I made a basic exper...
Mon Dec 01, 2008 7:46 pm UTC
Forum: Science
Topic: Childhood (not so) crackpot theories
Replies: 435
Views: 68939

### Re: Childhood (not so) crackpot theories

Hello all, first new topic for me, but I'm curious, how many of you had psuedo scientific theories or fantasies when you were younger; i.e. before teens. I found the other day a "theory" of mine; I went like so; "Black holes supposedly are singularities. Before the big bang, all the ...
Sat Nov 29, 2008 9:17 pm UTC
Forum: Science
Topic: Childhood (not so) crackpot theories
Replies: 435
Views: 68939

### Re: Childhood (not so) crackpot theories

Hello all, first new topic for me, but I'm curious, how many of you had psuedo scientific theories or fantasies when you were younger; i.e. before teens. I found the other day a "theory" of mine; I went like so; "Black holes supposedly are singularities. Before the big bang, all the ...
Wed Nov 26, 2008 3:20 pm UTC
Forum: Science
Topic: Help with balancing reactions using matrix of coefficients..
Replies: 3
Views: 915

### Re: Help with balancing reactions using matrix of coefficients..

Well, I may have posted in the wrong forum entirely sorry, considering that my program involves programming, chemistry, and linear algebra, I wasn't sure where to put it, but I figured since chemists must have some knowledge of math this was the best place to put my query. To answer your question, I...
Wed Nov 26, 2008 4:46 am UTC
Forum: Science
Topic: Help with balancing reactions using matrix of coefficients..
Replies: 3
Views: 915

### Help with balancing reactions using matrix of coefficients..

Ok, so I'm writing a program in Java for balancing chemical reactions. What I'm planning to do is basically take a chemical reaction and balance the reaction using the system of linear equations that you can create by by assigning a variable to each individual compound and then creating a linear equ...