Questions tagged [base-conversion]

Conversion of numbers between positional numeral systems. Most common systems are decimal, binary, hexadecimal etc.

9
votes
1answer
280 views

Negative XOR primes

About a year ago you were asked to find the XOR primes. These are numbers whose only factors are 1 and themselves when performing XOR multiplication in base 2. Now were are going to spice things up ...
13
votes
4answers
270 views

Convert between balanced bases!

Balanced bases: Balanced bases are essentially the same as normal bases, except that digits can be positive or negative, while in normal bases digits can only be positive. From here on, balanced ...
18
votes
12answers
1k views

Output N in base -10

Challenge: In the programming language of your choice, accept an integer as input in base 10, and output it in the negadecimal notation, which is also known as base -10 Example algorithm: This is ...
33
votes
46answers
4k views

What is the reverse (binary) bit number?

So you are given a POSITIVE base 10 (decimal) number. Your job is to reverse the binary digits and return that base 10 number. Examples: ...
25
votes
21answers
3k views

Converting “0xUsernames”

0xUsernames There's so many people using a messaging service that they're running out of space to store all the usernames! To fix this, they are going to start storing usernames as hexadecimal, where ...
19
votes
6answers
675 views

Count the characters - bit by bit!

The simple part: Given an input string containing only printable ASCII-characters (space - tilde), count the number of occurrences of each character and return the result on any convenient format. The ...
15
votes
9answers
719 views

Sloping Binary Numbers

Given an integer n, output the first n sloping binary numbers, either 0- or 1-indexed. They are called this because of how they ...
21
votes
28answers
1k views

The Baum-Sweet Sequence

The Baum-Sweet Sequence (A086747 with a Twist) Take in a positive integer n and print the integers from 1 to n for which the Baum-Sweet sequence returns true. The ...
12
votes
2answers
283 views

The Professor's base building number converter

The nutty maths professor wants to encode all of their research using a system sure to fox even the wiliest of their competitors! To this end the professor has decided to change the base of not just ...
7
votes
4answers
198 views

The Primitive and Basic Numbers

Your task is to generate the "Primitive and Basic" numbers, which are made like so: Start with 110. Take the digits of its base-1 representation (110 = 11) and interpret them as base-2 digits. This ...
11
votes
7answers
439 views

Sum digits till Square

Given is any integer x > 0 and any base y > 3. Sum all digits of x (if written in the set base). Multiply this by the highest possible digit (is always base -1). ...
32
votes
55answers
6k views

Binary to decimal converter

Binary to decimal converter As far as I can see, we don't have a simple binary to decimal conversion challenge. Write a program or function that takes a positive binary integer and outputs its ...
15
votes
9answers
800 views

All the Xenodromes

Introduction A xenodrome in base n is an integer where all of its digits in base n are different. Here are some OEIS sequences of xenodromes. For example, in base 16, ...
17
votes
11answers
1k views

Find the Emirps!

An emirp is a non-palindromic prime which, when reversed, is also prime. The list of base 10 emirps can be found on OEIS. The first six are: ...
47
votes
23answers
9k views

Count down from “Infinity”

Seems like an impossible task right? Well, it's actually not that hard. If we write the word Infinity as 8-bit binary ASCII code, we'll get: ...
16
votes
18answers
1k views

Digital Diversity

A positive integer may be represented in an integer base 1 <= b < inf. When converted to that base it has some number of distinct digits. Any positive ...
26
votes
13answers
5k views

Cheating a multiple choice test, part 2

This is sequel to this challenge by Adnan. If you like this challenge, chances are you'll like the other one too. Check it out! A multiple choice test with 8 questions each with 4 choices might have ...
23
votes
23answers
1k views

The Base in the mix

Input: A list/array of integers for which each item is in the range of 2-36. Output: The sum of the integers (as base 10), where each next integer is in the base ...
16
votes
14answers
710 views

Non-palindromic numbers

A strictly non-palindromic number N is a number that isn't a palindrome in any base (in bases 2 to N-2). These numbers are listed on OEIS For example, the number ...
31
votes
33answers
5k views

What base is this number in?

Here's a nice easy challenge: Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain ...
3
votes
0answers
185 views

Convert to and from signed octal [closed]

Write some code to do the following: Take as its input a signed integer in either signed decimal or signed octal (explained below) If the number is decimal convert it to octal. If it's octal, convert ...
16
votes
20answers
819 views

Decompose a number!

Your task is to decompose a number using the format below. This is similar to base conversion, except that instead of listing the digits in the base, you list the <...
14
votes
6answers
746 views

ASCII Art Mayan Numerals

This challenge is simple. Given a number, output a ascii-art representation of the number, using the Mayan Base-20 numeral system. What is the Mayan system? The Mayans used base 20 to store numbers,...
-5
votes
1answer
109 views

Negative base conversion [duplicate]

We already have a base conversion question, but not one with negative bases (nope, this doesn't count). (Corresponding wiki article.) You will receive a number (may be negative) and a base (must be ...
3
votes
10answers
1k views

Is it really a comcoin?

Very interesting background Comcoins are a currency like any other. The residents of Multibaseania (an economically robust system of city-states with very few residents in a galaxy far, far away) use ...
17
votes
7answers
2k views

Primes in Different Bases

Challenge: You are given a base 10 number. For each base from 10 counting down to base 2: Take the original input number as a base 10 string, and remove any digits of the number which are invalid ...
4
votes
7answers
547 views

Write a program that converts unary input to binary, decimal, and hexadecimal equivalents

Write a program that accepts input (through stdin) as a string of unary numbers delimited by spaces, and prints the equivalent string of numbers in binary, decimal, and hexadecimal. These unary ...
1
vote
0answers
71 views

Convert a base-10 number into a number of any other base [duplicate]

You have to take a base-10 number (e.g. 735) and another number for the base to convert to, and convert the base-10 number into the equivalent number in the other base. Rules: You aren't allowed to ...
20
votes
6answers
3k views

X+Y=Z - but in which base?

The Challenge Given 3 numbers X, Y and Z in base B, ...
20
votes
18answers
962 views

Repdigit Base Finding

A repdigit is a natural number that can be written solely by repeating the same digit. For example, 777 is a repdigit, since it's solely composed of the digit ...
30
votes
28answers
2k views

Decompose binary into alternating subsequences

This was inspired by Problem 13 - Non-Repeating Binary of HP CodeWars' recent competition. Let's take a random decimal number, say 727429805944311 and look at ...
16
votes
11answers
850 views

Sum of Binary Substrings

This challenge is simple, given a decimal number, convert to binary, and calculate the sum of the sub-strings of the binary number, whose length is shorter than the original number. Here is an example:...
11
votes
11answers
1k views

Octal, Decimal, or Hexadecimal?

Given an input string containing only letters and numbers, write a program or function that prints the possible printable ASCII characters (Hex 20-7E) that correspond with the string's value in bases ...
8
votes
3answers
280 views

Convert a “mixed-base” string to ASCII

Given an input of a string with bytes that may be in either binary, octal, or hex, output the string's ASCII equivalent. Input will be provided in the following format, for example: ...
26
votes
2answers
1k views

Residue Number System

In the vein of large number challenges I thought this one might be interesting. In this challenge, we will be using the Residue Number System (RNS) to perform addition, subtraction, and ...
2
votes
1answer
215 views

“Fouriest” Transform of An Integer [duplicate]

Challenge Inspired by this SMBC comic, discussed on reddit, math.stackexchange, and calculus7, the challenge is to return the lowest base such that a number is "fouriest." Description [From the ...
14
votes
2answers
622 views

Fibonacci’s sexagesimals

Leonardo da Pisano a.k.a Fibonacci was instrumental in bringing the Hindu-Arabic numeral system into Europe. Before that, mathematicians there worked in base sixty with Roman numerals. For example, ...
7
votes
2answers
278 views

Find the nth base-b digit of (b^k-1)^-2

Task Your task is simple. Write a program or function which takes three positive integer arguments n, k, and b in any order, such that 2 ≤ b ≤ 36, and returns or outputs the nth (1-indexed) base-b ...
14
votes
29answers
1k views

Zeroes in interval

Your task is to write a function or program that takes two non-negative integers i and k (i ≤...
20
votes
14answers
1k views

All your base palindromic belong to us

Generate the sequence number of bases in which n is a palindrome (OEIS A126071). Specifically, the sequence is defined as follows: given a number ...
5
votes
1answer
230 views

Look and Say sequence in any base

We all already crossed the look and say sequence, and where asked to guess the next element. As its name tells it very well, you just have to say what you see : ...
16
votes
9answers
936 views

Base Conversion With Strings

Introduction We've have a few base conversion challenges here in the past, but not many designed to tackle arbitrary length numbers (that is to say, numbers that are long enough that they overflow ...
26
votes
6answers
3k views

1+1 = 10, 1+2 = 3

Write a function or program than can do simple arithmetic (addition, subtraction, multiplication and division) in both base 10 and base 2. The function will take a mathematical expression as input, ...
23
votes
32answers
2k views

Convert a number to Hexadecimal

Challenge Here's a simple one. Write a function or program when given a number in base 10 as input, it will return or print that number's value in Hexadecimal. Examples ...
26
votes
17answers
2k views

A multiplication table for the Cheela

The Cheela (from the book Dragon's Egg by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they ...
45
votes
23answers
2k views

Hexadecimal and the Alphabet

In this challenge, you will receive an input, convert it to hexadecimal, make a couple changes, and output the result. Because they are only 16 characters in hexadecimal, your code will need to be as ...
42
votes
48answers
5k views

Numbers that are actually letters

Given a non-negative integer input, write a program that converts the number to hexadecimal and returns a truthy value if the hexadecimal form of the number contains only the characters ...
23
votes
11answers
1k views

Find the nth Fibohexaprime

The challenge this time is to find the nth Fibohexaprime. The definition of a Fibohexaprime is as following: We first observe a list with Fibonacci numbers: ...
20
votes
17answers
930 views

Find the sum of all possible base representations

The objective of this challenge is to write a program to convert an inputed string of what can be assumed as containing only letters and numbers from as many bases between 2 and 36 as possible, and ...
0
votes
0answers
65 views

An alphabet position quickie to motivate us all [duplicate]

It has been said, or copied from http://ifunny.co/fun/SiQ7PlRR3 rather, that if... A B C D E F G H I J K L M N O P Q R S T U V W X Y Z equals... ...