Phigital Number Base

Let $\varphi$ be the golden ratio: $\varphi=\frac{1+\sqrt{5}}{2}.$
Remarkably it is possible to write every positive integer as a sum of powers of $\varphi$ even if we require that every power of $\varphi$ is used at most once in this sum.
Even then this representation is not unique.
We can make it unique by requiring that no powers with consecutive exponents are used and that the representation is finite.
E.g:
$2=\varphi+\varphi^{-2}$ and $3=\varphi^{2}+\varphi^{-2}$

To represent this sum of powers of $\varphi$ we use a string of 0’s and 1’s with a point to indicate where the negative exponents start.
We call this the representation in the phigital numberbase.
So $1=1_{\varphi}$, $2=10.01_{\varphi}$, $3=100.01_{\varphi}$ and $14=100100.001001_{\varphi}$.
The strings representing $1$, $2$ and $14$ in the phigital number base are palindromic, while the string representing $3$ is not. (the phigital point is not the middle character).

The sum of the positive integers not exceeding $1000$ whose phigital representation is palindromic is $4345$.

Find the sum of the positive integers not exceeding $10^{10}$ whose phigital representation is palindromic.

To find the expected score, we can use dynamic programming to build up the solution iteratively.

First, we define a function `expected_score(n)` that takes an integer `n` as input and returns Alice’s expected score for that value of `n`. We will also define `memo` as a dictionary to store already computed values in order to memoize the function and avoid redundant calculations.

“`python
def expected_score(n, memo={}):
if n in memo:
return memo[n]

if n == 1:
return 1

score = 0
for i in range(1, n+1):
score += expected_score(i-1) / n

memo[n] = score + n / n
return memo[n]
“`

In this function, we first check if the value of `n` has been computed before and stored in `memo`. If so, we return the previously computed value to avoid redundant calculations.

Next, we handle the base case where `n = 1`. In this case, Alice always ends the game immediately, so her expected score is 1.

For larger values of `n`, we iterate over the possible numbers on the card (from 1 to `n`). For each number `i`, we calculate the expected score given that Alice chooses that card. This is done by recursively calling `expected_score(i-1)` for the previous numbers, and dividing the sum by `n` to get the average contribution of each number.

Finally, we add `n/n` to account for the case where Alice chooses to end the game immediately after seeing the first card.

To find `F(10^6)`, we simply call the `expected_score` function with `n = 10**6`:

“`python
n = 10**6
result = expected_score(n)
print(format(result, ‘.10f’))
“`

This will compute Alice’s expected score for `n = 10^6` and print the result with 10 decimal places.

Note: The computation for `F(10^6)` using this recursive approach may take some time to complete. To speed up the calculation, we can use memoization to store and reuse intermediate results.

More Answers:
Super Ramvok
Triangle Inscribed in Ellipse
Comfortable Distance II

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Don't Miss Out! Sign Up Now!

Sign up now to get started for free!