+ 18

*DAILY-MINI-CHALLENGE* : ANY TEXT CAN BE STORED IN A (!VERY BIG!) NUMBER AND EACH NUMBER CAN REPRESENT ANY TEXT. CHECK IT OUT!!!

A string s = "hi" can be converted into a number x: 1) split string into characters "hi" = ['h','i'] 2) convert each character to its asci_numbr ['h','i'] = [104,105] 3) start at i = 0..s.length-1: multiply each ascii-value with (256^i) and build the sum of it 104*(256^0) + 105*(256^1) = 26984 = x Backwards: While x > 0 you have to do 1) y = x%256 2) msg += ascii_char(y) 3) x = x // 256 This returns the msg = "hi" WHAT DOES x = 1701013870 MEANS? https://code.sololearn.com/cNd0BKGghjAE/?ref=app

14th Aug 2017, 9:57 PM
Julian Fechner
Julian Fechner - avatar
36 Answers
15th Aug 2017, 5:51 AM
Negacion Maximus
+ 23
Nice. But why are you screaming?
14th Aug 2017, 10:09 PM
Salekin
Salekin - avatar
+ 11
Guess I will give it a shot
14th Aug 2017, 10:21 PM
MizoPro
MizoPro - avatar
+ 7
is it 'hello world'?
14th Aug 2017, 10:19 PM
Harvey S. Cajegas
Harvey S. Cajegas - avatar
+ 6
I'll try this too, here it is: https://code.sololearn.com/WFsgk0vg00kS/ Nice! 👍 the hi's sum is: 26984 I could call it maxi-challenge for JavaScript by the big numbers, plus planning a solution.
15th Aug 2017, 1:45 AM
ysraelcon
ysraelcon - avatar
+ 5
no ... NOT "hello world" !
14th Aug 2017, 10:20 PM
Julian Fechner
Julian Fechner - avatar
+ 5
Will take a shot at this first, wants winner 😂
14th Aug 2017, 10:41 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
for $0: what is "nice"? 14357682231834248035556943223
14th Aug 2017, 11:06 PM
janKalupana
janKalupana - avatar
15th Aug 2017, 12:15 AM
Edgar Garrido
Edgar Garrido - avatar
+ 3
@Julian you got a minor mistake on your question. "hi" should be represented as 26984 in base 256. 👌
15th Aug 2017, 2:39 AM
Zephyr Koo
Zephyr Koo - avatar
+ 2
Here's my C# implementation with customizable number base:- https://code.sololearn.com/czfxMhjho33G/?ref=app *UPDATE* With reverse implementation as well 😄 LINQ One-Liner 〰 Enumerable.Range(1, str.Length).Sum(n => str[n - 1] * Math.Pow(256, n - 1));
15th Aug 2017, 2:41 AM
Zephyr Koo
Zephyr Koo - avatar
+ 2
@Sayantan wich language? ^^ if you're using js there are several librarys for 'bigint'. but you have to download most of them... https://stackoverflow.com/questions/4557509/javascript-summing-large-integers
15th Aug 2017, 8:05 AM
Julian Fechner
Julian Fechner - avatar
15th Aug 2017, 10:57 AM
sja31
sja31 - avatar
+ 2
Nice challenge mate, this would make for a pretty good encryption. Here's my attempt. https://code.sololearn.com/cgj3SlchmQS4/?ref=app
15th Aug 2017, 4:41 PM
Garikai
Garikai - avatar
+ 1
i didn't understand
15th Aug 2017, 4:49 AM
Younes Damouna
Younes Damouna - avatar
15th Aug 2017, 9:20 AM
Michał Bujakowski
Michał Bujakowski - avatar
15th Aug 2017, 12:45 PM
Matthias W
15th Aug 2017, 1:18 PM
Julian Fechner
Julian Fechner - avatar
+ 1
HEY CODERS OUT THERE... NEW *DAILY CHALLENGE* RIGHT HERE: https://www.sololearn.com/discuss/645450/?ref=app
21st Aug 2017, 3:44 PM
Julian Fechner
Julian Fechner - avatar
+ 1
MY NEW *DAILY CHALLENGE*: GIVE IT A TRY!!! https://www.sololearn.com/discuss/647083/?ref=app
22nd Aug 2017, 10:23 AM
Julian Fechner
Julian Fechner - avatar