20151201, 17:49  #1 
"Mike"
Aug 2002
2^{2}×3×5×7×19 Posts 
December 2015

20151202, 02:20  #2 
Romulan Interpreter
Jun 2011
Thailand
2^{3}·19·61 Posts 
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 20151202 at 02:24 
20151202, 05:35  #3 
"Robert Gerbicz"
Oct 2005
Hungary
5A2_{16} Posts 
"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. 
20151202, 10:47  #4  
Jun 2003
2^{3}×607 Posts 
Quote:
Quote:


20151202, 16:43  #5 
"Robert Gerbicz"
Oct 2005
Hungary
10110100010_{2} Posts 
Right. Now I think that I understand the problem. So it asks to convert the 52 EBCDIC letters (az, AZ) 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.

20151202, 17:31  #6 
"Forget I exist"
Jul 2009
Dumbassville
2^{6}×131 Posts 
ai > subtract 28
jr > subtract 39 sz > subtract 47 AI > subtract 128 JR > subtract 135 SZ > 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$ AI} \\ 4, & \mbox{if }X\mbox{$\notin$ AI} \end{cases} $ not sure if this is what they mean. 
20151202, 18:45  #7 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
3×3,109 Posts 
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? 
20151208, 14:10  #8 
Oct 2007
Manchester, UK
2^{2}×5×67 Posts 
An interesting problem. Here's what I have so far:
f(x) = 97  ((x AND 64) / 2) + (x AND 15) + ((x AND 48) / 2)  (((x16) 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... 
20151208, 23:16  #9 
Oct 2007
Manchester, UK
53C_{16} Posts 
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 
20151209, 00:59  #10 
"Forget I exist"
Jul 2009
Dumbassville
2^{6}×131 Posts 
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 20151209 at 00:59 
20151210, 23:39  #11 
Oct 2007
Manchester, UK
10100111100_{2} Posts 
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.

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
December 2017  Batalov  Puzzles  4  20180104 04:33 
December 2016  Xyzzy  Puzzles  11  20170124 12:27 
December 2014  Xyzzy  Puzzles  13  20150102 19:41 
Conference in Amsterdam 12 December  fivemack  Information & Answers  6  20111212 13:13 
Server update in December  ltd  Prime Sierpinski Project  4  20101217 13:14 