Author Topic: String to Number... ONE Number.  (Read 9090 times)

0 Members and 1 Guest are viewing this topic.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
String to Number... ONE Number.
« on: November 05, 2009, 10:10:34 pm »
Yeah. I'm trying to do the impossible.

How do you convert a string into a single distinguishable number and back again?

The current code I have for encoding is:

Code: [Select]
DelVar A
Input Str1
sub(length(Str1->A
For(X,1,length(Str1
A+2^inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ_"sub(Str1,X,1->A
End
Disp A

EDIT: FYI, the string "OMNIMAGA" would produce 66180.08.
Now, you would think that that is pretty distinguishable, right?
Wrong.

Comments? Questions?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: String to Number... ONE Number.
« Reply #1 on: November 06, 2009, 10:15:37 am »
Yay!!! New Puzzle for me!!!!~~~ I'm with you to the quest of finding the solution :D


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: String to Number... ONE Number.
« Reply #2 on: November 06, 2009, 10:53:04 am »
Well for now I am going to point out where you are going wrong, but I'll leave the rest up to you (unless you insist you really need help :P)  Lets say the word is AB.  So 2^1 + 2^2 = 2+4 = 6.  Yay! But since we are adding two numbers into the same digit, we can't know if it is 2+4 or 4+2.  The problem here is that new Characters ovewrite and change previous digits, and that needs to not happen :)

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: String to Number... ONE Number.
« Reply #3 on: November 06, 2009, 02:31:09 pm »
Yeah... You know what I figured??? The probability of 7 character combination is 8,031,810,176 possibility,
since there are 26 characters, you do 26^length of word
It's really big number, and after 8th character, the calculator rounds


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: String to Number... ONE Number.
« Reply #4 on: November 06, 2009, 03:06:31 pm »
Actualy its 14 digits.  The calculator only displays 8 tho

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: String to Number... ONE Number.
« Reply #5 on: November 06, 2009, 05:07:06 pm »
So, what are you trying to say, Builderboy? Are you saying that 2^X isn't distinguishable enough to be decoded? Or are you saying that the encoding process is wrong?

And, yes, I really need your help. :)
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: String to Number... ONE Number.
« Reply #6 on: November 06, 2009, 05:43:18 pm »
Well let me first put this out.  The calculator only stores 14 digits, and each digit can range from 0 to 9.  That is 10^14 states.  That many states can only hold nine 26 state characters.  Meaning the largest word you can compress will be 5 letters or less.  And that is with fantastic compression that would probably involve changing of bases XD

This is the way I would do it, which would be 7 characters per number:

If you have a number, with 14 digits, it looks like this
##############

And any character can be represented by a 2 digit number 00-25.  So divide up the digits
##|##|##|##|##|##|##

Where each set of digits converts to a character in a string.  This method gives you a fair 77% of the possible information able to be stored in a single number though.  But you can do any character from 0-99, so that is a bonus.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: String to Number... ONE Number.
« Reply #7 on: November 06, 2009, 06:16:19 pm »
Hmm...

expr(sub("E14E12E101E81E61E41E2",3X-2,3))inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,X,1)) ?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: String to Number... ONE Number.
« Reply #8 on: November 06, 2009, 06:54:49 pm »
I'm assuming the E represents the little Scientific notation E?

You could simplify to 10^(2X) or something of the like

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: String to Number... ONE Number.
« Reply #9 on: November 06, 2009, 07:00:46 pm »
10^(2X)?

That seems like a bit much. Care to explain?

And, yes, it represents the little scientific E. :p

EDIT: Oh. Ha. I'm a retard. I get it.

EDIT 2: YES! Encoding finished! Working on decoding.

EDIT 3: Having issues with decoding.

Code: [Select]
"?->Str1
For(X,1,dim(L1
DelVar (theta)DelVar BL1(X->A
Repeat B
If not(int(10^((theta))(exponent -1)A
1->B
Pause (theta)
(theta)+1(not(B->(theta)
End
For(C,(theta)-2,0,-2
27+(C<0)int(10^(C)(exponent -1)A->D
Pause D
Str1+sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ_",D,1->Str1
fPart(10^((theta)-2)(exponent -1)A->A
End
End
"sub(Str1,2,length(Str1)-1
Pause Str1

Do you see what I'm trying to do here?
It refuses to work though.
What am I missing here?
« Last Edit: November 06, 2009, 10:25:46 pm by ProphetsDementia »
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: String to Number... ONE Number.
« Reply #10 on: November 06, 2009, 10:31:57 pm »
I actually am working on this, and is almost done... I just need to work on decoding.
I will upload it as soon as I'm finished.
Or may be just put the code :P


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: String to Number... ONE Number.
« Reply #11 on: November 06, 2009, 10:35:14 pm »
Thanks, man. It's nice to know that I have a wingman on this project.
:)

EDIT: Finished! WOO!
Man, that thing was a beast to accomplish.

You guys want the code?
« Last Edit: November 07, 2009, 10:41:32 am by ProphetsDementia »
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: String to Number... ONE Number.
« Reply #12 on: November 07, 2009, 12:38:18 pm »
Double-post again. Sorry.

(DJ Omnimaga, if the post is getting marked new, then why is the topic not going up to the top? Why is the time not changing?)
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: String to Number... ONE Number.
« Reply #13 on: November 07, 2009, 01:29:03 pm »
Because the post isn't any newer. It will still be marked as new, but will still be sorted by date. Lately there were a lot of posts, though, so it might be slightly harder to notice through the latest post list.

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: String to Number... ONE Number.
« Reply #14 on: November 07, 2009, 01:36:58 pm »
Yeah!! I finished it too!!!!!!! My program will code and decode upto 10 programs accurately.
Coding takes 106 Bytes and Decoding takes 177 Bytes, when I set the program name to 1 character.
I probably can optimize it tho. ProphetsDementia, you wanna compare the programs???
I'll post the code first~

Coding:
Code: [Select]
:0->C
:Input Str1->A
:For(X,1,A
:inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,X,1->B
:C+B(26^(A-X->C
:End
:C->A
:DelVar BDelVar CDelvar Str1Disp A

Decoding:
Code: [Select]
:" ->Str1 //1 space
:Input C
:C->B
:0->A
:Repeat B<=0
:A+1->A
:B-26^A->B
:End
:For(X,A-1,0,-1
:0->B
:Repeat C<=26^X or B=26
:B+1->B
:C-26^X->C
:End
:If X=0 and C=1
:B+1->B
:Str1+sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",B,1->Str1
:End
:sub(Str1,2,A->Str1
:DelVar ADelVar BDelVar CDisp Str1

The decoding happened pretty much by luck, I just put random codes in and hoped that it to work properly  :P


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*