Skip to Content
Technical Articles

little algorithm riddle

Dear community, a little bit of fun today. I recently saw an algorithm that really surprised me by his effectivity. Mankind has known this algorithm for some time. I tried an implementation in ABAP out of interest. I hope the implementation works 😉 What is the name?

I put the answer in mirror writing under the source code. Hold a mirror to your screen. Instead of a mirror a smartphone screen is sufficient to “decode”, too 🙂

If someone also has a little algorithm riddle, feel free to write a blog. If the implementation doesn’t work properly, no problem. I guess there are some members here who can fix this 😉

[..]
CLASS-METHODS do_something
   IMPORTING
     x             TYPE i
     y             TYPE i
   RETURNING
     VALUE(result) TYPE i.
[..]
METHOD do_something.
  IF x = 1.
    result = y.
  ELSE.
    IF x MOD 2 > 0.
      result = y + do_something( x = x DIV 2
                                 y = y + y ).
    ELSE.
      result = do_something( x = x DIV 2
                             y = y + y ).
    ENDIF.
  ENDIF.
ENDMETHOD.
[..]

Here ist the answer:

ƨɒ nwonʞ oƨlɒ ,”noiɈɒɔilqiɈlυm Ɉnɒƨɒɘq nɒiƨƨυЯ” ɘʜɈ ʇo noiɈɒɈnɘmɘlqmi nɒ ƨi ɈI
.”noiɈɒɔilqiɈlυm nɒiqoiʜɈƎ” ɿo “noiɈɒɔilqiɈlυm nɒiɈqγϱƎ ɈnɘiɔnA”

 

Best regards and thanks for reading

Michael

 

 

 

 

2 Comments
You must be Logged on to comment or reply to a post.