# Hexadecimal, octal, binary, oh my! [duplicate]

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

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

## Example:

Input: 4a3d

Octal: 45075

Same number interpreted as decimal: 45075

Divide by 2: 22537.5

Output: 5809.8

• What's with the downvote? – Redwolf Programs Apr 14 '18 at 14:38
• 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. – RedClover Apr 14 '18 at 14:44
• 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. – Post Rock Garf Hunter Apr 14 '18 at 15:03
• 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. – Post Rock Garf Hunter Apr 14 '18 at 15:14
• @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! – Redwolf Programs May 3 '19 at 23:38

# Perl 6, 30 bytes

{(:16(\$_).base(8)/2).base(16)}


Try it online!

# Javascript,5653 52 bytes

-3 bytes thanks to @ovs

-1 byte thanks to @Arnauld

p=parseInt,a=>(p(p(a,16)[s='toString'](8))/2)[s](16)


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

Try it online!

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