Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

50%
+1 −1
Challenges Convert to Hexadecimal

Challenge Write a program that takes in a number greater than or equal to 0 and outputs its representation in hexadecimal (base 16). Examples 0 => 0 1 => 1 10 => A 15 ...

2 answers  ·  posted 8d ago by CrSb0001‭  ·  last activity 2d ago by CrSb0001‭

Question code-golf math base hexadecimal
#3: Post edited by user avatar CrSb0001‭ · 2025-04-13T02:14:21Z (6 days ago)
  • ## Challenge
  • Write a program that takes in a number in base 10 and outputs its representation in [hexadecimal (base 16)](https://en.wikipedia.org/wiki/Hexadecimal).
  • ---
  • ## Examples
  • ```none
  • 0 => 0
  • 1 => 1
  • 10 => A
  • 15 => F
  • 16 => 10
  • 107 => 6B
  • 153 => 99
  • 207 => CF
  • 1000 => 3E8
  • 10381 => 288D
  • 48821 => BEB5
  • ```
  • ---
  • ## Rules
  • * No built-in hexadecimal functions.
  • * More generally, any base conversion function is considered to be disallowed.
  • * Letters can be uppercase or lowercase.
  • * It should work at least for all inputs greater than 0 up to the language's default type limit.
  • * Leading zeros in the output is fine. (i.e. `000003E8` for 32-bit numbers)
  • * This is [code-golf], so shortest code wins.
  • ## Challenge
  • Write a program that takes in a number greater than or equal to 0 and outputs its representation in [hexadecimal (base 16)](https://en.wikipedia.org/wiki/Hexadecimal).
  • ---
  • ## Examples
  • ```none
  • 0 => 0
  • 1 => 1
  • 10 => A
  • 15 => F
  • 16 => 10
  • 107 => 6B
  • 153 => 99
  • 207 => CF
  • 1000 => 3E8
  • 10381 => 288D
  • 48821 => BEB5
  • ```
  • ---
  • ## Rules
  • * No built-in hexadecimal functions.
  • * More generally, any base conversion function is considered to be disallowed.
  • * Letters can be uppercase or lowercase.
  • * It should work at least for all inputs greater than 0 up to the language's default type limit.
  • * Leading zeros in the output is fine. (i.e. `000003E8` for 32-bit numbers)
  • * This is [code-golf], so shortest code wins.
#2: Post edited by user avatar CrSb0001‭ · 2025-04-11T15:34:27Z (7 days ago)
  • ## Challenge
  • Write a program that takes in a number in base 10 and outputs its representation in [hexadecimal (base 16)](https://en.wikipedia.org/wiki/Hexadecimal).
  • ---
  • ## Examples
  • ```none
  • 0 => 0
  • 1 => 1
  • 10 => A
  • 15 => F
  • 16 => 10
  • 107 => 6B
  • 153 => 99
  • 207 => CF
  • 1000 => 3E8
  • 10381 => 288D
  • 48821 => BEB5
  • ```
  • ---
  • ## Rules
  • * No built-in hexadecimal functions.
  • * Letters can be uppercase or lowercase.
  • * It should work at least for all inputs greater than 0 up to the language's default type limit.
  • * Leading zeros in the output is fine. (i.e. `000003E8` for 32-bit numbers)
  • * This is [code-golf], so shortest code wins.
  • ## Challenge
  • Write a program that takes in a number in base 10 and outputs its representation in [hexadecimal (base 16)](https://en.wikipedia.org/wiki/Hexadecimal).
  • ---
  • ## Examples
  • ```none
  • 0 => 0
  • 1 => 1
  • 10 => A
  • 15 => F
  • 16 => 10
  • 107 => 6B
  • 153 => 99
  • 207 => CF
  • 1000 => 3E8
  • 10381 => 288D
  • 48821 => BEB5
  • ```
  • ---
  • ## Rules
  • * No built-in hexadecimal functions.
  • * More generally, any base conversion function is considered to be disallowed.
  • * Letters can be uppercase or lowercase.
  • * It should work at least for all inputs greater than 0 up to the language's default type limit.
  • * Leading zeros in the output is fine. (i.e. `000003E8` for 32-bit numbers)
  • * This is [code-golf], so shortest code wins.
#1: Initial revision by user avatar CrSb0001‭ · 2025-04-11T01:20:34Z (8 days ago)
Convert to Hexadecimal
## Challenge

Write a program that takes in a number in base 10 and outputs its representation in [hexadecimal (base 16)](https://en.wikipedia.org/wiki/Hexadecimal).

---

## Examples

```none
0     => 0
1     => 1
10    => A
15    => F
16    => 10
107   => 6B
153   => 99
207   => CF
1000  => 3E8
10381 => 288D
48821 => BEB5
```

---

## Rules

* No built-in hexadecimal functions.
* Letters can be uppercase or lowercase.
* It should work at least for all inputs greater than 0 up to the language's default type limit.
* Leading zeros in the output is fine. (i.e. `000003E8` for 32-bit numbers)
* This is [code-golf], so shortest code wins.