APL (using Dyalog APL):
⍝ left(⍺):address, right(⍵):n OverTheRoad ← {⍺-⍨1+2×⍵} 1 OverTheRoad 3 6 3 OverTheRoad 3 4 3 OverTheRoad 5 8 7 OverTheRoad 11 16 ⍝ Short, "tacit" form OverTheRoad ← -⍨+1+⊢ ⍝ Arithmetic automatically maps over multiple numbers! 1 3 3 7 OverTheRoad 3 3 5 11 6 4 8 16
(Use the bookmarklet on this post to see the code with APL font and syntax highlighting.)
Explanation: The sum of two houses facing each other is always the same for given n, which is 2n+1. So the opposite house number becomes 2n+1-address.
n
2n+1
2n+1-address
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
APL (using Dyalog APL):
(Use the bookmarklet on this post to see the code with APL font and syntax highlighting.)
Explanation: The sum of two houses facing each other is always the same for given
n
, which is2n+1
. So the opposite house number becomes2n+1-address
.