21 December 2012

Pick Up: It's a golden car

Script:
PANEL 1
Ryan: So whose car are we going in?
Michael: mine
Ryan: What? I thought it would be mine because mines cool
PANEL 2
Michael: It is cool but my car has dimensions which are closer to the "Golden Ratio"
Ryan: Does this mean what I think it means?
Michael: I don't know
Ryan: It's a real lady puller
PANEL 3
Michael: Not exactly... the gears are spaced to make it more fuel efficient. It has a go fast stripe though!

The golden ratio value is irrational so to 5 decimal places it is 1.61803. A while ago someone did a experiment putting different rectangle on a sheet of paper and they asked volunteers to select the most beautiful rectangle and would you have guessed it, it was the one that had a ratio of 1:1.61803... among other reason like Fibonacci numbers this is why this number may be considered beautiful. Sorry it has been so long, had to have the script tweaked, the car is meant to be based on the old volvo cars, nice and boxy. They have hat and scarves because it's winter and cold, sorry about facial expressions. Like I said before if you are a better artist or you know someone who would do this for FUN, get in touch.

Also it's the time of year for presents (Yay!) the giving and receiving of presents. For some people just staying warm is hard enough. The reason I'm saying this is as mathematicians we don't really believe in luck we believe in chaos and probability. Some people have everything going for them then that small chance of probability hits and things gets worse. Someone's situation may be their fault but some of it could be down to the pesky "no-way-is-that-going-to-happen" probability. Maybe this Christmas think of others. Merry Christmas and a happy new year.

15 November 2012

Maths Events in the London area

A while ago I was asked to publicise maths events in the London area, that might be of interest to London based university mathematics students. I was asked on behalf of the IMA (the Institute of Mathematics and its Applications.).
I am not a member of the IMA and all the views in this blog are my own and no way are representative of the IMA.
The Facebook page had been already set up so all I had to do is populate it with events. Harder than you can imagine and also I do need an audience so they can read it (current time of writing it has 190 fans) so I brought it over to twitter, since this is where I was getting any events from.
On Facebook I did run an advert campaign for 2 days trying to aim for London universities i.e.:
  • Birkbeck University
  • City University London
  • University of Greenwich
  • Imperial College London
  • Kingston University
  • Kings College London
  • London Metropolitan University
  • London School of Economics
  • The Open University???
  • Queen Mary, University of London
  • Royal Holloway, University of London
  • UCL, University College London
The main twitter accounts I got my maths event information is these: There is others so I put them in a twitter list not all talk about events, but most of the links are of some interest. If you know of any events please tweet @IMALonEvents or write on the facebook page please.

17 October 2012

Three word guessing game

This I heard from Alistair from Out of the Norm at one of the MathJams a couple of people wondered if you could put this online, well I believe I have done it. The rules are simple, someone puts in a valid three letter word, then the other person guesses using valid three letter words. If you guess one letter or 3 letters correct you will get the result of "odd", if you get 2 letters correct the result is even, if all the letters are correct and in the right order result is "finish".

A couple of things I haven't done, CAN'T play against the computer it is a 2 player game, also can't verify if the word is a proper three letter word apart from that it's all good

Pick a three letter word

12 October 2012

Pick Up: It's friday comic 001

Script
PANEL 1
2 seconds to 5pm

PANEL 2
5pm

PANEL 3
Ryan:It's Friday, it's the weekend

PANEL 4
Ryan:Hey Michael, are we going out tonight and you still on for being my wingman
Michael:Yep

PANEL 5
Michael:What club do you want to go to
Ryan:er

PANEL 6
Ryan:Let me find out

PANEL 7
Michael:Are you doing goal programming?
Ryan:Yeah

PANEL 8
Michael:Don't bother, I know what club your going to pick
Ryan:Oh yeah, which

PANEL 9
Michael:Club Panther, it's the only one that serves woo woo drinks
Ryan:What, it's a nice drink.

If you haven't seen "Harold and Kumar" they start with an goal and then get side tracked. That was the idea of what this is hopefully going to be.

In Panel 6 Ryan is rating amount of women in a bar. The problem is he hasn't stated if the women are single and or straight. He could have ended up in a lesbian bar. Last panel I mentioned woo woo drinks just a reference to Aled from the Chris Moyles show, it's ended after 8 years (longest running breakfast show in bbc Radio 1).

Due to amount of free time I have hopefully I'll do one at least once a month. By the way I know the drawing is rubbish, if you fancy doing the art email me(James Clare) AT.

30 August 2012

a while ago I said I may post comics or drawings on here. Well I have done a rather hint of rudeness comic:
In case you can't tell the script is this:

GIRL: Hmm nice what aftershave is that?
GUY: It's not aftershave it's citrus shampoo
GIRL: wow wonderful
GUY: Yeah. If I get get lucky, my other regions smell real good.

Not the best script (or drawing) but I wasn't planning on being amazing, just constantly improving. That was a slightly true story. I don't wear aftershave mainly because I'm forgetful and I don't think it adds a nicer smell. Someone said I smelt nice, I knew it wasn't aftershave cause I don't wear any. It was in fact my underarm (antiperspirant deodorant) that smelt nice (the last panel I added cause I thought it was a good joke). Anyway I had an idea for a (maybe) less rude comic idea, here is the script:

GUY:The title for this book is wrong, there is not 50 shades there is infinity shades of grey, anyway what is this book about?
GIRL: A girl talking about S & M.
GUY: You mean Single Machine scheduling.
GIRL: Er...not quite.

The end goal is maybe come up with a running storyline, for the moment though I'll just have fun.

11 August 2012

Drawing something

A while ago I was playing with a few friends an application called "Draw Something" basically the idea is you choose from a list what you want to draw, you submit it and then your friend guesses what you drew. Sounds good. Only after you play a while some of the words crop up again so the idea of playing seems pointless.

Anyway a friend of mine rarely check the application so I write to him on facebook to come on and play (most of the time using colourful language). My last attempt to persuade my friend I drew this:

Not the greatest drawing in the world, but it looks like a cowboy saying a line similar to the one in "Dirty Harry". I was thinking "Draw Something" will never ask me to draw something like this. I may put random pics I drew on here, maybe.

16 July 2012

Changing Bases

I have just started reading Alex's Adventure in Numberland" and in it, he started talking about counting in different bases and how different cultures count (I won't spoil it for you don't worry). One thing he said was learning the times tables would be easier and I can't disagree i.e.

3 times table
  • 3 x 1 = 3
  • 3 x 2 = 6
  • 3 x 3 = 9
  • 3 x 4 = 10
  • 3 x 5 = 13
  • 3 x 6 = 16
  • 3 x 7 = 19
  • 3 x 8 = 20
  • 3 x 9 = 23
4 times table
  • 4 x 1 = 4
  • 4 x 2 = 8
  • 4 x 3 = 10
  • 4 x 4 = 14
  • 4 x 5 = 18
  • 4 x 6 = 20
  • 4 x 7 = 24
  • 4 x 8 = 28
  • 4 x 9 = 30

The reason for it's simplicity is because 12 has more factors 1,2,3,4 and 6, whereas 10 has 1,2 and 5.

I wanted to know whether it was more good looking. When I was in primary school we made shapes on squares paper by using the times tables. First pick a point and then go in a clockwise direction (North, East, South and West) and plot the 2 times table. When you get to a 2 digit number like 14, you add the digits together (1 + 4 = 5) and plot this number.

For example this is base 10. times table 1 to 5.

How does this compare with base 12?

Personally I think base 12 looks better, more patterns. If you are interested there is a UK and USA society dedicated to base 12. These pictures was created using Paint.NET (Windows)(I created the grid myself).

1 June 2012

Physica Mbrick3 beginners guide

I may have mentioned that for my MSc project I designed a website that should make it clearer what lines are available for what module and what they do. This is so you can create an inform file. To run physica you do need a geometry file as well. There is one called MBrick and this creates a file (meshfilename.mb) this then creates a geometry file (meshfilename.geo) when run in physica and will then produce some outputs.
This will be your beginners guide to using MBrick (also known as MB3).
first it would be a good idea to have a vague idea of what you are going to mesh, so start off with a picture (the measurements are in mm). The thickness of the block is 5mm.
This maybe a bit over the top with markings but you do now see what is trying to be modelled. The following will be how you approach the problem if you are entering the data here. The text based approach and description is available here
First we want to know whether the mesh will have deformations(-8) or not(-9). In this case no deformations so '-9'. Now we want to know scale, scale is measured in meters. Since our model is in millimetres we will put in 0.001. The next decision is whether this is a cylindrical model, it's not so '0'.
Next we have Spans we have to divide up the block into sections and measure them
Length Divisions Comment
8.0 8 Inlet width
5.0 1 Slice thickness
20.0 16 pipe length
15.0 12 lower space height
10.0 8 upper space height
20.0 16 space width
12.0 10 outlet width
For deri-left and deri-right stick to the default 1.0. Deri-left and deri-right control mesh spacing. If for instance both (deri-left and deri-right) are greater than 1.0 then the mesh will start bunching up nearer to the middle. If however both are less than 1.0 then the mesh will bunch at the left and right ends. A combinations of higher or lower deri-right and deri-left maybe what you need, for the time being stick with default. Our spans now look like this:
 1   8.0   8  1.0  1.0    inlet width
 2   5.0   1  1.0  1.0    slice thickness
 3  20.0  16  1.0  1.0    pipe length
 4  15.0  12  1.0  1.0    lower space height
 5  10.0   8  1.0  1.0    upper space height
 6  20.0  16  1.0  1.0    space width
 7  12.0  10  1.0  1.0    outlet width

If you think about there is now have 6 rectangles which has to be created. Next we have to specify the 'Zero Mark' this is where you specify the starting point for the model. So x, y and z coordinate is all 0.0 and the Mark_ID is 0 as well.
From (0.0, 0.0, 0.0) you work up and outwards, what spans do we add in the x, y and z direction (NB The thickness is going to be in the y plane). The image should help you make sense of how you add in the x, y and z direction. First we move in x, y and z direction, in x we have 'inlet length', in y we have 'thickness' and z we have 'pipe length'. Second we only move in x and z, x we move 'pipe length', in z we move 'lower space height'. Finally third we move in x and z only, in x we move 'outlet width' and z we move 'upper space height'. The Marks including 'Zero Mark' look like this:
 0   0.0  0.0  0.0
 1   1   2   3
 2   6   0   4
 3   7   0   5
What has been created is a block, a solid block, we want to specify which volumes we are interested in to get to our model. First the goal is to specify where the pipe is. From the previous picture you can see it is located between mark 0 and mark 1 in x direction, mark 0 and mark 1 in y and mark 0 and 1 in z direction. The first line then is:
 0  1   0  1   0  1    2        inlet pipe
The last number, '2' is the zone number.

I'm ignoring the next line in zones because it is complicated (find out more after you see the text).

Second line we want to specify the big section. This section lies between 0 and 2 in the x direction (horizontal), in the z direction (vertical) it is between 1 and 3. The y direction (thickness) is between 0 and 1. The specification for this is:
 0  2   0  1   1  3    2        central space
The zone number for this is also 2.
Third and fourth area is similar to specify. For zones we have:
 0  1   0  1   0  1    2        inlet pipe
-12  0 0. 1 0.  0 0. 1 0.  0 0. 0 10.  1      initial level
 0  2   0  1   1  3    2        central space
 2  3   0  1   1  2    3        under outlet
 2  3   0  1   2  3    4        cut away

NB Additional feature: if mx0 = -12, the numbers after it are interpreted as follows:
i0 dx0 i1 dx1 j0 dy0 j1 dy1 k0 dz0 k1 dz1 zone_ID [c]
i0, i1 - lower and upper reference marks along x
dx0, dx1 - x-displacements of lower and upper zone ends from their ref. marks
j0, j1 - lower and upper reference marks along y
dy0, dy1 - y-displacements of lower and upper zone ends from their ref. marks
k0, k1 - lower and upper reference marks along z
dz0, dz1 - z-displacements of lower and upper zone ends from their ref. marks

The above "additional feature" is a cheat. What it does in this case is re writes the bottom half of the pipe and labels it as being zone 1.
What should have been done instead, which is a lot easier to understand is re-write the spans as being:
 1   8.0   8  1.0  1.0    inlet width
 2   5.0   1  1.0  1.0    slice thickness
 3  10.0   8  1.0  1.0    lower pipe length
 4  10.0   8  1.0  1.0    upper pipe length
 5  15.0  12  1.0  1.0    lower space height
 6  10.0   8  1.0  1.0    upper space height
 7  20.0  16  1.0  1.0    space width
 8  12.0  10  1.0  1.0    outlet width
and then re write the marks as being:
 0   0.0  0.0  0.0
 1   1   2   3
 2   7   0   4
 3   8   0   5
 4   0   0   6
after that you then re write your zones as being:
 0  1   0  1   0  1    1      initial level
 0  1   0  1   0  2    2        inlet pipe
 0  2   0  1   2  4    2        central space
 2  3   0  1   2  3    3        under outlet
 2  3   0  1   3  4    4        cut away
Easy. Anyway next up we have to specify the patch numbers. What you may not know is that when this runs it produces a file called 'bricks.txt' which shows you what the zones look like and the number of divisions (it wont show you spacing of the divisions). At the sides of this model, there will be numbers -1 will be on the left, -6 on top, -2 on the right, -5 on the bottom and unfortunately it won't show you the thickness (y) direction. There you would have seen -3 nearest to you, -4 furthest from you. These number are in fact zones. By the way bricks.txt number grid looks like this:
 0-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6 0
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4-2
-1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2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 0 0 0 0 0 0 0 0-2
 0-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5 0
The patches are listed below:
-1  0   5       central symmetry
-2  3   4       side free slip
-3  0   7       symm. low  y
-4  0   8       symm. high y
-5  1   1       inlet
-6  0   6       top free slip
 0  1   3       walls
 0  2   3
 0  3   3
 4  2   9       upper side
 4  3   2       oulet

The first one might be slightly confusing, the '-1' is the left hand side of the model, the '0' being in the second column means it actually is the same as:

-1   1   5
-1   2   5

So you can see it includes everything next to '-1'. The next patch i.e. patch 4 is the border between -2 and zone 3. The rest is similar. Patch 3 however is slight different. As you see in bricks.txt there is a lot of '0', well if any of them are next to 3, 2 or 1 then they are patch 3.

The final bit of the MBrick is material number. The entry is:
1  1
2  1
3  1
4  0

That is to say zone 1, 2 and 3 are material 1 and zone 4 will not be meshed. zone 4 is only needed to specify the outlet in patch format.

The overall text for the MBrick file looks like this:
  -9    0.001    0
 1   8.   8  1.2  0.5    inlet width
 2   5.   1   1.  1.     slice thickness
 3  20.  16  1.0  0.5    pipe length
 4  15.  12  0.4  0.6    lower space height
 5  10.   8  0.6  0.6    upper space height
 6  20.  16  0.4  0.8    space width
 7  12   10  0.8  0.5    outlet width
 -9
 0   0.  0.  0.
 1   1   2   3
 2   6   0   4
 3   7   0   5
 -9
 0  1   0  1   0  1    2        inlet pipe
-12  0 0. 1 0.  0 0. 1 0.  0 0. 0 10.  1      initial level
 0  2   0  1   1  3    2        central space
 2  3   0  1   1  2    3        under outlet
 2  3   0  1   2  3    4        cut away
  -9
-1  0   5       central symmetry
-2  3   4       side free slip
-3  0   7       symm. low  y
-4  0   8       symm. high y
-5  1   1       inlet
-6  0   6       top free slip
 0  1   3       walls
 0  2   3
 0  3   3
 4  2   9       upper side
 4  3   2       oulet
 -9
1  1
2  1
3  1
4  0
-9

17 May 2012

Installing and using PHYSICA

When I have to install PHYSICA I am given 3 files and then some example cases. the 3 files are:
  1. physica3g.exe
  2. phy3g.bat
  3. phylic.dat this one is the licence file
According to the physica website you are given a CD with a file called pinstall.bat I was never given this, so I have to do this manually. The first step is to group these 3 files and the examples into a folder call it 'Physica' and put it in the root of the computer (i.e. for windows computers it should be in the path C:\Physica). After this we need to add some paths in the computer so it knows what to run. For Windows XP computers:
  • Step 1: Right hand click on 'My Computer' and select properties OR press the 'Start' button then click 'Control Panel' and click on 'System'
  • Step 2: There are a number of tabs on the top of 'System Properties' you will be automatically on the 'General' tab, click on the 'Advanced' tab. This will have Performance settings, User profiles settings, start up and recovery settings. You can ignore all of these as you want a button called 'Environment Variable'.
  • Step 3: Under 'System Variables' section You need to create a new variable called 'PHYKEY' so click 'New'. The Variable name will be 'PHYKEY' and the Variable Value will be the path to physica.exe so it should be 'C:\Physica'.
  • Step 4: We are not yet done with 'System Variable'. You need to edit 'Path' Variable. Select the variable and click edit (or double click path variable) Under Variable Value we need to ADD something to the end of it. Put ';C:\Physica' and click 'ok' and you are done.
  • Step 5: Testing. Run one of the test cases to check it runs. Open up the 'command prompt' located by clicking start button, click 'All programs','Accessories' then 'Command Prompt'. Back up to C:\ by typing 'cd ..' do this until it says 'C:\' then type 'cd ' then the path to one of the test cases then type 'phy3g' or if your 'phy3g.bat' is called something different type that in and it should work perfectly.

If you are getting started with Physica or your out of practise with physica you can use the Website or the website I designed for my MSc project. My one actually generates the inform file for you, it also can generate mesh and plotpar files you can use (you have to rename them as just 'inform','filename.md' and 'plotpar' though).

Plotpar files produce pretty images, although you do have to install Ghostscript and GSview to view these images, these application are free to download

3 May 2012

What is a facebook page rss feed?

The author who i found this out from ahrengot.com/ found out when you go to a page it sometimes has numbers after it i.e. Mousehunt which page is

http://www.facebook.com/pages/MouseHunt/273678496019476
You can use the number to create a rss feed which looks like this
http://www.facebook.com/feeds/page.php?format=rss20&id=273678496019476
This works, some pages still have this feature which is brilliant.

Unfotunately facebook has upgraded the pages, which is good for design and looks good but they forgot about the people who like rss. Fear not, whilst scrolling through the comments one person (Stanwin) found the solution. What he did was on the page you want the rss off, go to photos (i presume this works with other stuff) click on an image and the url will look like this:

http://www.facebook.com/photo.php?fbid=354695431234035&set=a.318573378179574.69412.318522041518041&type=1&theater
The number in bold is the one your interested in and you repeat what you did before so rss looks like
http://www.facebook.com/feeds/page.php?format=rss20&id=318522041518041
And there you go it's all done.

18 April 2012

Quadractic equation

This equation I like more than the "beatiful" equation () mainly becaus it's not that mysterious. There is certain propoties of the quadractic equation that can be looked at and tested.
1st one is what shape will the equation be:

x^2x
Is the shape of:



And The second property you can get is directly from the quadractic equation, whether a equation has 2 roots, 1 root or it has imaginary roots

x^2x
b^2-4ac=
How many roots has this equation got?



Okay that was fun hope you enjoy.

18 March 2012

CodeEval FizzBuzz

CodeEval is a site where programmers can compete for jobs or in my case hopefully learn something more. I have small experience in Java and Visual Basic. I have slightly more experience in HTML, JavaScript and PHP. So I use this site for practise.
The 1st problem they put on there is FizzBuzz, the problem is below:

Description

Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by 'A' e.g. three is replaced by the word fizz and any divisible by 'B' e.g. five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is either eliminated.

Write a program that prints out the the pattern generated by such a scenario given the values of 'A'/'B' and 'N' which are read from an input text file. The input text file contains three space delimited numbers i.e. A, B, N. The program should then print out the final series of numbers using 'F' for fizz, 'B' for 'buzz' and 'FB' for fizz buzz.

Input sample:

Your program should read an input file (provided on the command line) which contains multiple newline separated lines. Each line will contain 3 numbers which are space delimited. The first number is first number to divide by ('A' in this example), the second number is the second number to divide by ('B' in this example) and the third number is where you should count till ('N' in this example). You may assume that the input file is formatted correctly and is the numbers are valid positive integers.e.g.

3 5 10
2 7 15

Output sample:

Print out the series 1 through N replacing numbers divisible by 'A' by F, numbers divisible by 'B' by B and numbers divisible by both as 'FB'. Since the input file contains multiple sets of values, your output will print out one line per set. Ensure that there are no trailing empty spaces on each line you print.e.g.

1 2 F 4 B F 7 8 F B
1 F 3 F 5 F B F 9 F 11 F 13 FB 15

Unfortunately when I did the Java solution I couldn't do it, so I searched for the solution online. DO NOT CLICK LOOK UNLESS YOU HAVE TRIED IT FIRST
/*Sample code to read in test cases:
public class fizzbuzz {
    public static void main (String[] args) {
    ...
    File file = new File(args[0]);
    BufferedReader in = new BufferedReader(new FileReader(file));
    String line;
    while ((line = in.readLine()) != null) {
        String[] lineArray = line.split("\s");
        if (lineArray.length > 0) {
            //Process line of input Here
        }
    }
  }
}
*/
import java.io.*;

import java.util.*;

public class fizzbuzz {

    public static void main(String[] args) throws IOException{

        Scanner console = new Scanner(new FileReader(args[0]));
        while(console.hasNext()){
            int first=console.nextInt();
            int second =console.nextInt();
            int third =console.nextInt();

            for(int i=1;i<=third;i++){
                if(i%first==0 && i%second==0 ){
                    System.out.printf("FB ");
                }
                else if(i%first==0)
                    System.out.printf("F ");
                else if(i%second==0)
                    System.out.printf("B " );
                else
                    System.out.printf("%d ",i);
            }
            System.out.println();
        }
        console.close();
    }
}
The last bit of the code I can do, it's just I couldn't read a file.
I also decided to see if I could do it in PHP as well
<?php
 /*Sample code to read in test cases:
 $fh = fopen($argv[1], "r");
 while (true) {
 $test = fgets($fh);
 # break loop if $test is an empty line
 # $test represents the test case, do something with it
 }
 */
    $file_get_contents=fopen($argv[1],"r");
     while ( ($line = fgets($file_get_contents)) !== false) {
     $k=0;
           foreach(preg_split("/[\s]/", $line) as $space){
              if($k==0){
                  $f=$space;
               }
                if($k==1){
                  $b=$space;
                }
               if($k==2){
                   $n=$space;
                }
                $k=$k+1;
            }
           for($i=1;$i<=$n;$i++){
                if(($i % $f==0)&&($i % $b==0)){
                 echo "FB ";
                }
                elseif($i % $f==0){
              echo "F ";
             }
                elseif($i % $b==0){
                 echo "B ";
                }
                else{
                 echo $i." ";
                }
            }
            echo "\n";
        }
 ?>
Good tip they do provide comments to help you through it, which is rather handy. Anyway I also tried to do it in JavaScript:
/*Sample code to read in test cases:
function codeEvalExecute(line) 
{ //your code goes here. line is your test case 
//return 
}*/
function codeEvalExecute(line){
 //an array with 3 values
 var Byline=line.split(" ");
 //fizz
 var f=Byline[0];
 //buzz
 var b=Byline[1];
 //number run to
 var n=Byline[2];
 var string="";
 
 for(var i=1;i<=n;i++){
  if((i % f==0)&&(i % b==0)){
          string=string+"FB ";
        }
        else if(i % f==0){
           string=string+"F ";
       }
        else if(i % b==0){
            string=string+"B ";
        }
        else{
           string=string+i+" ";
       }
 }
 return string;
}
Update 18/03/2012 11.59am
I should point out if you want to learn JavaScript or PHP I suggest w3 school as for Java I don't know any sites so put some in the comments if you have a suggestion