MakeWebGames

# Count in base 27

## Recommended Posts

I am trying to make a script which generates all the possible letter combinations to a certain length. Is there anyway to count in base 27, by this I mean

```for(\$a=1; a<10000; a+=1)
{
if (\$a=1) {
\$b='a'
}
```

etc..

It would then enter the string into a database.

It would count like this http://www.thecrimelife.com/files/example.txt NOTE: I typed this up.

Any help would be appreciated.

##### Share on other sites

Re: Count in base 27

to count in different bases learn how to use the modulus operator http://us2.php.net/operators.arithmetic

##### Share on other sites

Re: Count in base 27

Any example of a code how to do this?

##### Share on other sites

Re: Count in base 27

```<?
\$a = 85;
\$b = 24;
echo "

Original value of \\$a is \$a and \\$b is
\$b</P>";

\$c = \$a % \$b;
echo "

The modulus of \\$a and \\$b is \$c</P>";

?>
```

basically what you want to do is find the remainder (modulus) of the number you have, and the base you want it in.

So for example, if you want to express "43" in base 8:

first divide 43 by 8 = 5 point something

then find the remainder with 43 mod 8 = 3

so 43 in base 8 would be 5*8 + 3

sort of like how 43 in base 10 is 4*10 + remainder (3)

##### Share on other sites

Re: Count in base 27

Ah. I think I get it now. :-D

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×

• #### Marketplace

• Discord Chat
• PBBG Directory
×
• Create New...