Click here to Skip to main content
15,891,633 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
theCPkid18-May-10 1:50
theCPkid18-May-10 1:50 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
CPallini18-May-10 1:54
mveCPallini18-May-10 1:54 
GeneralRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage18-May-10 9:01
ant-damage18-May-10 9:01 
QuestionRe: algorithm to get each individual digit from a decimal number (integer) Pin
CPallini18-May-10 10:01
mveCPallini18-May-10 10:01 
AnswerRe: algorithm to get each individual digit from a decimal number (integer) Pin
ant-damage18-May-10 10:25
ant-damage18-May-10 10:25 
QuestionUnique number from two numbers [modified] Pin
theCPkid15-May-10 2:58
theCPkid15-May-10 2:58 
AnswerRe: Unique number from two numbers Pin
Luc Pattyn15-May-10 4:18
sitebuilderLuc Pattyn15-May-10 4:18 
GeneralRe: Unique number from two numbers Pin
theCPkid15-May-10 5:02
theCPkid15-May-10 5:02 
sorry, i did not mean to use f(x) + f(y) but f(x,y). my mistake. Frown | :(
so what I want to know is if it is possible to convert 2 numbers into a single unique number so that instead of storing two numbers, I can store just one number. Then afterwards, while reading the stored data, I read one number and apply the inverse of f to get my two numbers x & y.

say for eg. Z = 17*x^2 + y^2
for (x,y) = (3,4)
Z = 17*9 + 16 = 169
to get x,y from 169, possible values will be x = [1,4,9]; equivalent y will then be = [153, 101, 16]
since 16 is the only perfect square, so i get x=3, y=4.

I was just wondering about this problem. It's not required in any practical application. So, you can assume that x,y belongs to a set of ALL POSITIVE INTEGERS only. or better 0<x<=y<10000

And order in which inputs are given does not matter.

I hope I am clear now.
GeneralRe: Unique number from two numbers Pin
Som Shekhar15-May-10 5:15
Som Shekhar15-May-10 5:15 
GeneralRe: Unique number from two numbers [modified] Pin
harold aptroot15-May-10 5:21
harold aptroot15-May-10 5:21 
GeneralRe: Unique number from two numbers Pin
Luc Pattyn15-May-10 5:34
sitebuilderLuc Pattyn15-May-10 5:34 
GeneralRe: Unique number from two numbers Pin
harold aptroot15-May-10 5:37
harold aptroot15-May-10 5:37 
GeneralRe: Unique number from two numbers Pin
Luc Pattyn15-May-10 5:40
sitebuilderLuc Pattyn15-May-10 5:40 
GeneralRe: Unique number from two numbers Pin
theCPkid15-May-10 5:47
theCPkid15-May-10 5:47 
GeneralRe: Unique number from two numbers Pin
harold aptroot15-May-10 5:49
harold aptroot15-May-10 5:49 
GeneralRe: Unique number from two numbers Pin
Luc Pattyn15-May-10 5:53
sitebuilderLuc Pattyn15-May-10 5:53 
GeneralRe: Unique number from two numbers Pin
theCPkid15-May-10 5:41
theCPkid15-May-10 5:41 
GeneralRe: Unique number from two numbers Pin
harold aptroot15-May-10 5:43
harold aptroot15-May-10 5:43 
GeneralRe: Unique number from two numbers Pin
Luc Pattyn15-May-10 6:00
sitebuilderLuc Pattyn15-May-10 6:00 
GeneralRe: Unique number from two numbers Pin
CPallini18-May-10 1:52
mveCPallini18-May-10 1:52 
GeneralRe: Unique number from two numbers Pin
CPallini17-May-10 22:37
mveCPallini17-May-10 22:37 
GeneralRe: Unique number from two numbers Pin
theCPkid18-May-10 1:39
theCPkid18-May-10 1:39 
GeneralRe: Unique number from two numbers Pin
CPallini18-May-10 1:45
mveCPallini18-May-10 1:45 
QuestionSocket message(frame) pattern matching Pin
Hamed Musavi13-May-10 7:42
Hamed Musavi13-May-10 7:42 
AnswerRe: Socket message(frame) pattern matching Pin
Luc Pattyn13-May-10 7:55
sitebuilderLuc Pattyn13-May-10 7:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.