mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2015-12-01, 17:49   #1
Xyzzy
 
Xyzzy's Avatar
 
Aug 2002

207716 Posts
Default December 2015

https://www.research.ibm.com/haifa/p...ember2015.html
Xyzzy is offline   Reply With Quote
Old 2015-12-02, 02:20   #2
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

9,787 Posts
Default

Technically, they should also define what an operator means, or give a link to the allowed operators table, same way they gave the link to the code sets. Otherwise, following their example, I have a solution with a single operator: "f(x)= x ebcdic_to_ascii"

Joking apart, I started programming Fortran in ~1982 in high school, on a Felix C256 (you can use translation, not very good, but English), our school had one, using punched cards with EBCDIC coding, we took turns on the about 60 card punchers in 4 or 5 rooms to "write" our projects (we had all these sorts of equipment, hehe), and then give the pack of cards to the operators who were running the "monster", scheduling the jobs, and come the following days to take the listing with the results. We were not allowed in the monster's room, except when "official tours" were given by a teacher, for study purpose. Also, the programs had to be well written and come out with a solution in a minute or so, otherwise they were interrupted, because other people (i.e. boxes of cards) were waiting in the queue. It was not nice when you came after one or two days, or more, and find in the shelf your listing, saying "time limit", and no results...

Later in life I already solved different versions of this "transmogrify" problem few times during my life, for practical reasons and/or for fun with colleagues.

Last fiddled with by LaurV on 2015-12-02 at 02:24
LaurV is offline   Reply With Quote
Old 2015-12-02, 05:35   #3
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

2·32·83 Posts
Default

"Technically, they should also define what an operator means, or give a link to the allowed operators table, same way they gave the link to the code sets. Otherwise, following their example, I have a solution with a single operator: "f(x)= x ebcdic_to_ascii" "

Or use no operator at all, reading the problem my first solution was: f(x)=10. (not submitted)
Reading the problem I think this is an absolutely correct solution.
R. Gerbicz is offline   Reply With Quote
Old 2015-12-02, 10:47   #4
axn
 
axn's Avatar
 
Jun 2003

514910 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
Or use no operator at all, reading the problem my first solution was: f(x)=10. (not submitted)
Reading the problem I think this is an absolutely correct solution.
Quote:
Find a formula to convert the 52 EBCDIC letters into ASCII using no more than 4 operators.
I am confused. How does your formula achieve the problem statement?
axn is offline   Reply With Quote
Old 2015-12-02, 16:43   #5
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

149410 Posts
Default

Quote:
Originally Posted by axn View Post
I am confused. How does your formula achieve the problem statement?
Right. Now I think that I understand the problem. So it asks to convert the 52 EBCDIC letters (a-z, A-Z) to their ASCII equivalent keeping also the case. It was poor wording, maybe the word "convert" and the example would give a hint about the real interpretation.
R. Gerbicz is offline   Reply With Quote
Old 2015-12-02, 17:31   #6
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

a-i -> subtract 28
j-r -> subtract 39
s-z -> subtract 47
A-I -> subtract 128
J-R -> subtract 135
S-Z -> subtract 143

so for the index difference going one way we have:

$f(X) =f(x)+100 -
\begin{cases}
0, & \mbox{if }X\mbox{$\in$ A-I} \\
4, & \mbox{if }X\mbox{$\notin$ A-I}
\end{cases} $

not sure if this is what they mean.
science_man_88 is offline   Reply With Quote
Old 2015-12-02, 18:45   #7
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

17×563 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
f(X) =f(x)+100 -<br />
\begin{cases} <br />
  0,  & \mbox{if }X\mbox{$\in$ A-I} \\<br />
  4, & \mbox{if }X\mbox{$\notin$ A-I} <br />
...<br />
\end{cases} ...
Simpler still, f(x) = x - g(x\16), where g(z) has domain of only six values and maps {8,9,10,12,13,14} -> {32,39,47,128,135,143}
Now the trick is two make g(z) with only two OPs (two are already used - and integer division \ (or AND with 240 can be used)).
Could be that g(z) = b[SUP]z[/SUP] % p (or z[SUP]b[/SUP] % p) with some b and p remaining to be found?
Batalov is offline   Reply With Quote
Old 2015-12-08, 14:10   #8
lavalamp
 
lavalamp's Avatar
 
Oct 2007
Manchester, UK

55216 Posts
Default

An interesting problem. Here's what I have so far:

f(x) = 97 - ((x AND 64) / 2) + (x AND 15) + ((x AND 48) / 2) - (((x-16) AND 32) / 32)

I'm using 12 operators, so clearly there's room for optimisation. I agree with earlier comments about it being very unclear which operators are allowed. For instance, powers and other fancy stuff seems like cheating, since those would require several instructions for a CPU to perform. But then they do ask for a mathematical expression, not assembly code...
lavalamp is offline   Reply With Quote
Old 2015-12-08, 23:16   #9
lavalamp
 
lavalamp's Avatar
 
Oct 2007
Manchester, UK

2×3×227 Posts
Default

Batalov, I did a search for your g(z) function, sadly without much success. I searched for prime p less than 100,000 and all b < p.

However, I did manage to reduce the number of operators to 8 in two different ways by using that trick:

f(x) = x - ( (x AND 48)^17 % 37 ) - 32 - 1.5*(x AND 64)

f(x) = (x - ( (x AND 48)^17 % 37 ) XOR 224) + (x AND 64)/2
lavalamp is offline   Reply With Quote
Old 2015-12-09, 00:59   #10
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by lavalamp View Post
f(x) = (x - ( (x AND 48)^17 % 37 ) XOR 224) + (x AND 64)/2
I'm guessing this doesn't scale down because 17 and 37 don't have a common factor of 8 like the others ?

Last fiddled with by science_man_88 on 2015-12-09 at 00:59
science_man_88 is offline   Reply With Quote
Old 2015-12-10, 23:39   #11
lavalamp
 
lavalamp's Avatar
 
Oct 2007
Manchester, UK

101010100102 Posts
Default

I realised that I was possibly overthinking this a bit. I've come up with a 4 operation, but laughably inefficient, way of doing this now. Don't want to post the solution before the month is out though.
lavalamp is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
December 2017 Batalov Puzzles 4 2018-01-04 04:33
December 2016 Xyzzy Puzzles 11 2017-01-24 12:27
December 2014 Xyzzy Puzzles 13 2015-01-02 19:41
Conference in Amsterdam 1-2 December fivemack Information & Answers 6 2011-12-12 13:13
Server update in December ltd Prime Sierpinski Project 4 2010-12-17 13:14

All times are UTC. The time now is 14:54.


Sat Oct 23 14:54:52 UTC 2021 up 92 days, 9:23, 0 users, load averages: 2.44, 2.35, 1.83

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.