P924
projecteuler.net

Larger Digit Permutation II

ℹ️Published on Saturday, 28th December 2024, 07:00 pm; Solved by 182;
Difficulty rating: 45%

Let B(n) be the smallest number larger than n that can be formed by rearranging digits of n, or 0 if no such number exists. For example, B(245)=254 and B(542)=0.

Define a0=0 and an=an12+2 for n>0. Let U(N)=n=1NB(an). You are given U(10)543870437(mod109+7).

Find U(1016). Give your answer modulo 109+7.



Soluzione

Last modified: May 27, 2025. Website built with Franklin.jl and the lovely Julia programming language.