This question already has an answer here:

This is a code golf puzzle: shortest byte count wins. The program should do the following (Standard loopholes forbidden):

  1. Input a hexadecimal number
  2. Convert to octal
  3. Then interpret the digits as if in decimal (765 octal -> 765 decimal)
  4. Divide the number by two
  5. Convert to hexadecimal


Input: 4a3d

Octal: 45075

Same number interpreted as decimal: 45075

Divide by 2: 22537.5

Output: 5809.8


marked as duplicate by Xcali, Sriotchilism O'Zaic code-golf Apr 14 '18 at 14:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ What's with the downvote? \$\endgroup\$ – Redwolf Programs Apr 14 '18 at 14:38
  • 1
    \$\begingroup\$ Welcome to PPCG! I'm not the downvoter, but personally I'd vote this as a duplicate of base-conversion challenge, since that's the same, just repeated. I'd suggest you to use our sandbox next time, it can help detect potential problems in the challenge. \$\endgroup\$ – RedClover Apr 14 '18 at 14:44
  • 1
    \$\begingroup\$ Hello, welcome to the site. I downvoted this challenge because it is a series of tasks, with no real motivation. I don't think the challenge is interesting. That being said don't feel discouraged to keep writing questions. Just because I think this challenge is bad doesn't mean I think you won't write good challenges in the future. \$\endgroup\$ – Sriotchilism O'Zaic Apr 14 '18 at 15:03
  • 2
    \$\begingroup\$ The most recent challenge I have upvoted was this. The main criteria I look for in a question are 1) Whether the challenge offers something new I haven't seen before 2) Whether the challenge is cohesive, that is whether its internal parts make sense with one another. 3) an arbitrary do I think it is fun criterion. If you want to get good at writing challenges I would suggest reading this. You might also look at this. \$\endgroup\$ – Sriotchilism O'Zaic Apr 14 '18 at 15:14
  • 1
    \$\begingroup\$ @SriotchilismO'Zaic It's been about a year since I created this question. Thanks for the feedback you gave, as it really helped me in future questions to avoid this mistake! \$\endgroup\$ – Redwolf Programs May 3 at 23:38

Perl 6, 30 bytes


Try it online!


Javascript,56 53 52 bytes

-3 bytes thanks to @ovs

-1 byte thanks to @Arnauld


toString on an integer converts the integer to a string in that base.

Try it online!

  • \$\begingroup\$ Had no idea the .toString(base) thing existed. Upvote for teaching me something new! \$\endgroup\$ – Redwolf Programs Apr 14 '18 at 14:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.