10
\$\begingroup\$

An even distribution number is a number such that if you select any of it's digits at random the probability of it being any particular value (e.g. 0 or 6) is the same, \$\frac1{10}\$. A precise definition is given later on.

Here are a few examples:

  • \$\frac{137174210}{1111111111} =0.\overline{1234567890}\$ is an even distribution number.
  • \$2.3\$ is not an even distribution number since 7 of the digits 1456789 never appear and all but two of the digits are 0.
  • \$1.023456789\$ may look like it's an even distribution number, but for this challenge we count all the digits after the decimal point, including all the 0s. So nearly all the digits are 0, and the probability of selecting anything else is \$0\$.

Precisely speaking if we have a sequence of digits \$\{d_0^\infty\}\$ then the "probability" of a particular digit \$k\$ in that sequence is:

\$ \displaystyle P(\{d_0^\infty\},k) = \lim_{n\rightarrow\infty}\dfrac{\left|\{i\in[0\dots n], d_i=k\}\right|}{n} \$

That is if we take the prefixes of size \$n\$ and determine the probability that a digit selected uniformly from that prefix is \$k\$, then the overall probability is the limit as \$n\$ goes to infinity.

Thus an even distribution number is a number where all the probabilities for each \$k\$, converge and give \$\frac1{10}\$.

Now a super fair number is a number \$x\$ such that for any rational number \$r\$, \$x+r\$ is an even distribution number.

Task

Output a super fair number. Since super fair numbers are irrational you should output as an infinite sequence of digits. You can do this using any of the defaults.

This is so the goal is to minimize the size of your source code as measured in bytes.

\$\endgroup\$
10
  • 2
    \$\begingroup\$ is the decimal point required if the number is <1? \$\endgroup\$
    – Makonede
    Commented Oct 5, 2023 at 15:45
  • 3
    \$\begingroup\$ Are solutions using a pseudorandom generator with a finite state valid? Technically, they output a rational number \$\endgroup\$ Commented Oct 6, 2023 at 5:19
  • 1
    \$\begingroup\$ May I assume \$\pi\$, \$e\$ or \$\sqrt2\$ are normal? \$\endgroup\$ Commented Oct 6, 2023 at 5:22
  • 1
    \$\begingroup\$ @Wheat Wizard: "even distribution" numbers are more commonly called simply normal (in base 10) numbers. \$\endgroup\$ Commented Oct 6, 2023 at 7:01
  • 1
    \$\begingroup\$ @CommandMaster: it is an open problem to show that any of those constants are simply normal. \$\endgroup\$ Commented Oct 6, 2023 at 7:01

9 Answers 9

5
\$\begingroup\$

Jelly, 4 3 bytes

‘Ṙß

Try it online!

Jelly, 7 bytes (if leading 0. is required)

.1¹2‘Ṙ¿

Try it online!

A niladic link that takes no arguments and prints Champernowne’s constant, one of the few numbers that have been proven ‘normal’, which is the more common term for this type of number (though the request here is more specifically for an irrational ‘simply normal’ number in base 10 which is an easier target to meet).

Thanks to @JonathanAllan for saving a byte!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ @FryAmTheEggman Well, an irrational simply normal number at least. \$\endgroup\$
    – Neil
    Commented Oct 6, 2023 at 7:26
  • 1
    \$\begingroup\$ ‘Ṙß for 3 if we may assume no recursion limit (which I guess we can). \$\endgroup\$ Commented Oct 6, 2023 at 15:17
4
\$\begingroup\$

R, 26 19 bytes

\(n)sample(0:9,n,T)

Attempt This Online!

Function that returns n digits, representing the digits after the decimal point.
The particular choice of super-fair number returned changes each time the function is called, since the digits are random.
Add +14 bytes to output digits from the same super-fair number on successive calls.

\$\endgroup\$
4
\$\begingroup\$

R, 19 18 bytes

repeat cat(F<-F+1)

Try it online!

Like my other answer, this outputs Champernowne’s constant. Thanks to @DominicVanEssen for saving a byte!

\$\endgroup\$
1
4
\$\begingroup\$

Python, 31 bytes

i=0
while[print(i,end="")]:i+=1

Attempt This Online!

Edit: since someone is downvoting all the Champernowne constant answers, I thought that I should prove that it is a super fair number.

I don't have time to write a formal proof right now, but the basic idea is that as you move further along Champernowne constant the period of the digits of the rational number gets insignificant compared to the period of most digits (of i).

This essentially means that we can treat the effect of the rational number as (a combination of) constant offsets. Applying a constant offset just has the effect of "rotating" when digits appear; it doesn't change their frequency.

Essentially the point is that only digits in the "middle" of i really matter, and what happens at the edges doesn't.

\$\endgroup\$
3
\$\begingroup\$

05AB1E, 8 2 bytes

∞S

Try it online! Outputs as a list of digits.

\$\endgroup\$
3
  • \$\begingroup\$ That's an even distribution number, not a super fair number. \$\endgroup\$
    – Wheat Wizard
    Commented Oct 5, 2023 at 15:27
  • \$\begingroup\$ @WheatWizard fixed \$\endgroup\$
    – Makonede
    Commented Oct 5, 2023 at 15:44
  • \$\begingroup\$ 3 bytes with --no-lazy, ∞ʒ? \$\endgroup\$ Commented Oct 6, 2023 at 5:21
1
\$\begingroup\$

Charcoal, 9 bytes

⭆N⁺‽χ….¬κ

Try it online! Link is to verbose version of code. Explanation: Prints i random digits.

If e is ever proven normal, then for 8 bytes:

×ψ⊕N¤≕E

Try it online! Link is to verbose version of code. Explanation: Prints the first i digits of e, which is believed to be normal.

\$\endgroup\$
3
  • \$\begingroup\$ Why the downvote? \$\endgroup\$
    – Neil
    Commented Oct 6, 2023 at 7:27
  • \$\begingroup\$ Apparently someone really really hates the Champernowne constant \$\endgroup\$
    – AnttiP
    Commented Oct 6, 2023 at 8:15
  • \$\begingroup\$ @AnttiP Indeed, but my answer doesn't use it... \$\endgroup\$
    – Neil
    Commented Oct 6, 2023 at 8:46
1
\$\begingroup\$

Nibbles, 3 bytes (6 nibbles)

(or 4 bytes (8 nibbles) if leading 0. is required.

+.,~`p

Attempt This Online!

Outputs the digits of Champernowne's constant. Credit to Nick Kennedy's answer for pointing-out that this has been proven to be a 'normal' number.


Nibbles, 3.5 bytes (7 nibbles)

+.,~`p*

Attempt This Online!

Outputs the digits of a different super-fair number, proven by Abram Besicovitch to be 'normal'. 5 bytes if the leading 0. is required.

\$\endgroup\$
1
\$\begingroup\$

Gaia, 3 bytes

ṅ$<

Try it online!

Prints the first \$n\$ digits of the Copeland–Erdős constant, the concatenation of the primes.

\$\endgroup\$
0
\$\begingroup\$

JavaScript (Node.js), 22 bytes

f=x=>x&&(f(x>>1)+x)%10

Try it online!

Looks messy but unproven

\$\endgroup\$
2
  • \$\begingroup\$ Not sure if it's a signal that it's wrong, but there's so many 01347801 in output \$\endgroup\$
    – l4m2
    Commented Oct 12, 2023 at 9:17
  • \$\begingroup\$ f(x) is the number, written in binary, summed mod 10, with digits weighted ... 5 7 3 1 5 7 3 1. As an alternative characterization, start with 0, and each time append it the sequence plus each of 1 3 4 7 8 0 1 5 6 8 9 2 3 5 6 mod 10. This can be used to show it's an even distribution number, I believe. Showing it's a super fair number is more complex, and I'm not sure how it could be done for fractions whose period isn't a power of 2. \$\endgroup\$ Commented Oct 13, 2023 at 3:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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