each octet actually contains 8 bits. in binary, this can be represented as 10101010.10101010.10101010.10101010
you're on the right track. you also need to account for network addresses and broadcast addresses as well.
the first address (0.0.0.0) is the network address and the last address (0.0.0.255) is the broadcast address. Number of host per network is 2^N - 2 , where n is the number of host bits.
For network, 192.168.0.0/24, the calcualtion is 2^8-2. should be 253
You are going to need to account for the subnet mask as well. The subnet mask is what separtates the host bits from the network bits.
Don't forget to exclude the private addresses.
reference
IP address - Wikipedia, the free encyclopedia
there is no method to this madness. i may be back later. I suggest researching subnetting a network.
IP addresses and Subnetting
good read on subnetting