Nice one ayman:
Solution written in pseudocode..
x: int input
s: string output

set s to ""
repeat three times{
 append ((char) (x % 26 + int('A'))) to s
 x /= 26
}
repeat three times{
 append ((char) (x % 10 + int('0'))) to s
 x /= 10
}
if x > 0 error "Impossible"
ayman are you sure N=1mil is impossible?
it should be anything above 10*10*10*26*26*26 = 17,576,000
In any case, I'm writing here a PHP code that would do what you asked.
I'm only missing echoing 'impossible' for values larger than 17576000 without a conditional
<?php

$customer_number = 65;
showplate($customer_number);

function showplate($customer_number) {
	$number = $customer_number-1;
	$plate=array();
	$plate[1]= floor(($number/(26*26*26*10*10))%10);
	$plate[2]= floor(($number/(26*26*26*10))%10);
	$plate[3]= floor(($number/(26*26*10))%10);
	$plate[4]= toletters(floor(($number/(26*26))%26));
	$plate[5]= toletters(floor(($number/26)%26));
	$plate[6]= toletters($number%26);
	$plate_number = implode($plate,"");
	echo $plate_number;
}

// this function prints the ascii value of the letters
function toletters($num) {
	return "&#".($num+65).";";
}

?>
Try changing $customer_number.
65 returns 000ACM
17576000 returns 999ZZZ
Correct answer for both arithma and duckster although ducster you should have added one condition so that in case the number is above 17,576,000 it would print impossible just as arithma did but thats okay.

Good job guys, now it is your turn arithma or duckster :)
ayman are you sure N=1mil is impossible?
it should be anything above 10*10*10*26*26*26 = 17,576,000
Actually in the example I meant 1000,000,000 instead of 1000,000 it was a typo :)
Reverse a single connected linked list. Best optimized algo (performance first, then memory usage) wins.
airthma made use of recursive calls and conditionals, which you noted was prohibited :)
and the no-conditionals rule was behind the reason I didn't check for 'impossible' numbers
airthma made use of recursive calls and conditionals, which you noted was prohibited :)
and the no-conditionals rule was behind the reason I didn't check for 'impossible' numbers
The concept is correct though, I liked his idea :P

If you look into my post, this is what I said:
Only one if statement is allowed to be used, this is the condition in which you have to print "Impossible".
Anyways, yours is correct, thanks for participating :)
yo ayman, guess we need to show the guys the correct answer (no loops, and pure algorithming (which excludes PHP built-in functions). So here it goes:

int N = 0;
int n1=0;
int n2=0;
int n3=0;
int c1=65;
int c2=65;
int c3=65;

N = "user entry" //may vary from language to language
//assume we are using java:
N=JOptionPane.showMessageInput("Enter a user number");

N=N-1;
c3=c3+N%26;
N=N/26;
c2=c2+N%26;
N=N/26;
c1=c1+N%26;
N=N/26;
n3=n3+N%10;
N=N/10;
n2=n2+N%10;
N=N/10;
n1=n1+N%10;
N=N/10;

if(N>0)
{
System.out.println("IMPOSSIBLE");
}
else
{
System.out.println(n1+""+n2+""+n3+""+(char)c1+""+(char)c2+""+(char)c3);
}
Wrong!!

What is the value of c3 if N = 10000 ?

Look at duckster's solution, you'll see what is wrong with yours . ;)
OK, back to reversing a single linked list already?

Here's a naive implementation that you should not put in:
define node as {int data; ref node next;} // contains a data member and a reference to the next node

void reverse_list(ref node n){
  ref node current = break_last(n); // declaration
  while( (ref node last = break_last(n)) != null ){
    current.next = last;
    current = last;
  }
}

ref node break_last(ref node n){
  while(n.next != null && n.next.next != null) n = n.next;

  if(n.next == null) return n;
  
  ref node result = n.next;
  n.next = null;
  return result;
}
Reverse a single connected linked list. Best optimized algo (performance first, then memory usage) wins.
so is this correct ?
struct node{ int data ; node * next }

node* reverse (node * list) {

           node *pt , *temp ;

           pt = list.next ;
           list.next = null ;
           while (pt != null){
                  temp = pt.next ;
                  pt.next = list ;
                  list = pt ;
                  pt = temp ;
           }
           return list ;
}
@GN90, you got it right.

The algorithm should be easier to think about in those terms that helped me while deriving the same algo, but in a recursive style:
void reverse_recursive( node * & rev, node * rest ){
	if(rest == 0) return;

	node * next = rest->next;
	rest->next = rev;
	rev = rest;
	reverse_recursive(rev, next);
}
Here's some code that I used to confirm your posted code and mine.
Your turn to question our abilities!

#include <iostream>
using namespace std;

struct node {
	int data;
	node * next;
};

node* reverse (node * list) {
	node *pt , *temp ;

	pt = list->next ;
	list->next = 0 ;
	while (pt != 0){
		temp = pt->next ;
		pt->next = list ;
		list = pt ;
		pt = temp ;
	}
	return list ;
}

void reverse_recursive( node * & rev, node * rest ){
	if(rest == 0) return;

	node * next = rest->next;
	rest->next = rev;
	rev = rest;
	reverse_recursive(rev, next);
}

void spit_list(node * p){
	while(p != 0) {
		cout << p->data << endl;
		p = p->next;
	}
}

void main(){
	node a = {1, 0};
	node b = {2, 0};
	node c = {3, 0};
	node d = {4, 0};

	a.next = &b;
	b.next = &c;
	c.next = &d;

	node * p = reverse(&a);
	spit_list(p);

	node * reverse = 0;
	reverse_recursive(reverse, p);
	spit_list(reverse);
}
Here is my entry in Java, not recursive but does the job, I should have posted it earlier yesterday :P
public void reverseList() 
{
    ListNode current = head;
    head = null;
    while (current != null) 
    {
        ListNode ptr = current;
        current = current.next;
        ptr.next = head;
        head = ptr;
    }
}
Same algo as GN90 actually :)
OK, here's one I haven't had the chance to solve yet (the problem is my original)
On christmas, our office has a secret santa event. Everyone's name is put into a bowl. Each employee comes in random order, and picks a name from the bowl (there is the unfortunate possibility of one picking their own name).

Looking at the (employee name - A, name of employee on card - B), there must be at least one loop (starting with a random employee, then going to the next employee based on the card the previous one chose).

A loop configuration is a list of the size of loops in ascending order.
An employee configuration is a list of numbers, giving each employee the number of the other employee on the car he chose.

For n employees, there are n! employee configurations.

Return, given n, the number of employee configurations for each loop configuration.

Example: n=1
{Loop Configurations, Corresponding employee configurations} = {(1), 1} -- there is only one loop possible, the employee to himself. There is only one employee configuration to begin with.

Example: n=2
{Loop, Configs} = {(2), 1}
{Loop, Configs} = {(1, 1), 1}
Either a loop of two employees, each being the santa of the other, or two loops, each employee being the santa of himself.
The sum of configs sums to 2! which is 2.

Example: n=3
{(3), 2}
{(2, 1), 3}
{(1, 1, 1), 1}
There are 3! employee configs in total. Each one being the santa of himself amounts to a single config. A loop going through all the employees has two possibilities (one in each direction (1, 2, 0) or (2, 0, 1) ). The rest of configurations belong to the middle case. Those configs are detailed below:
(0, 2, 1)
(2, 1, 0)
(1, 0, 2)
I haven't come down to an implementation yet, but the problem itself needs some understanding. I am working on my writing-a-problem skills, so please let me know where it needs clarification.
@ arithma : i didn't understand what should we do in the question you've posted

And here's my question: (its not a programing question cause I don't know what to post)
A drinks machine offers three selections - Tea, Coffee or Random
(Either tea or Coffee)but the machine has been wired up wrongly
so that each button does not give what it claims. If each drink
costs 50p, how much minimum money do you have to put into the
machine to find out which button gives which selection?
@GN90: The challenge itself is to figure out what the question is about, jokingly. I admit I failed to make it clear what the question is about.

I believe your question was asked and answered somewhere on this forum before. Something about entering a single coin and hitting random. The result determines what random is wired to. If it's coffee, then coffee button is tea, and tea button is random.

I think the question is more interesting if the wiring is done really randomly (with the possibility of a correct wiring).
arithma wrote@GN90: The challenge itself is to figure out what the question is about, jokingly. I admit I failed to make it clear what the question is about.

I believe your question was asked and answered somewhere on this forum before. Something about entering a single coin and hitting random. The result determines what random is wired to. If it's coffee, then coffee button is tea, and tea button is random.

I think the question is more interesting if the wiring is done really randomly (with the possibility of a correct wiring).
yeah , maybe it was asked.
and your answer is correct , sorry for this stupid question anyways :p

and it should be your turn now.
I think the question is more interesting if the wiring is done really randomly (with the possibility of a correct wiring).
Not really, since there is no way of solving this. If the wiring is done completely randomly, then there's no possibility of actually knowing. Think about it, the random button could (theoretically) give out Tea a million times straight. So technically there is no minimum amount of tries that guarantees a solution.

What would be impressive though is to modelize what I just wrote in a mathematical equation (or set of equations) that cannot be solved, thus proving that there is no way of finding a minimum value (Do I make sense to anyone ?)
To prove what you just said, the random button can return the same type of cup indefinitely, rendering any attempt to discover what the wiring is inept. Still, the truly random wiring is the more possible situation to face in real life.

I was thinking more about the problem being an optimization problem over the space of click sequence.
As in, what is the click sequence that will maximize your certainty (or minimize your uncertainty) about the wiring of the machine.

Machine has three Buttons: A, B, C; the types of drinks are A, B, R(random).

Think of this example sequence:

Click A. Returns A (we are calling the first drink it returns A to avoid unnecessary symmetry). 50% -> (A is wired to A) & 50% -> (A is wired to R)
Then Click B. case 1: Returns A: C is most definitely wired to B.
case 2: Returns B: All hell is loose probability wise.

I think the most suiting representation for the probabilities would be some kind of tree with assumptions and their probabilities as branches. We'd also have to represent the click sequences.
The difficulty is insane since we're modeling logic, and basing other logic on top of that.
a month later