Functions (CS): Level 3 Challenges

         

You have in your wallet $300, which you want to spend completely. You decide to spend all of it by buying food from a fancy restaurant with the following menu:

    tofu scramble: $1
    pancakes: $5
    brunch combo: $20
    saffron infused peach tea: $50
    truffles: $100
    caviar: $200

Let OO be the number of different ways that you can spend exactly $300. What are the last 3 digits of OO?

The number

(1+2)27\huge{(1+\sqrt{2})^{27}}

can be represented as xy+zx\sqrt{y} + z where x,yx,y and zz are positive integers.Find x+y+zx+y+z.

For all positive integers nn, the totient function ϕ(n)\phi (n) denotes the number of positive integers n\leq n coprime to nn.

It turns out that if we apply the totient function successively on any positive integer n>1n>1, after finitely many operations we get the number 11. In other words, for all positive integers n>1n>1, there exists a positive integer mm such that ϕ(ϕ(ϕ(ϕ(n))))m times=1\underbrace{\phi ( \phi ( \phi ( \cdots \phi (n ) \cdots )))}_{m \text{ times}}= 1.

For all nNn \in \mathbb{N}, let f(n)f(n) denote the minimum number of times we need to apply the totient function successively on nn to get the number 11. Find the last three digits of n=12014f(n)\displaystyle \sum \limits_{n=1}^{2014} f(n).

Details and assumptions

  • As an explicit example, here's how you'd find f(5)f(5): ϕ(5)=4ϕ(ϕ(5))=2ϕ(ϕ(ϕ(5)))=1\begin{array}{rcl} \phi (5)& = & 4 \\ \phi (\phi (5)) & = & 2 \\ \phi (\phi (\phi (5))) & = & 1 \\ \end{array} Note that we had to apply the totient function three times on 55 to get the number 11, so f(5)=3f(5)=3.

  • By convention, f(1)=0f(1)=0.

  • Just to clarify, this is a computer science problem.

Consider the rectangular spiral in the image below. It starts from the origin and twirls and twirls forever in an anticlockwise direction along the integer coordinates of the Cartesian coordinate plane.Each point along the spiral is numbered with an integer ZZ as shown in the image below.

What is the value of the integer ZZ at the coordinate (12,22)(12,-22)?

Details and assumptions

As an explicit example ZZ is 1010 for (2,0)(2,0) , 33 for (0,1)(0,1) and 1010 for (2,0)(2,0).

Given a list of integers 1n1\cdots n, return the count of the number that have the number kk in them. For n109n\leq10^{9} how many numbers have the number 77 in them.

Details and Assumptions

For n10n\leq10, the number of occurrence of 77 is one.

For n100n\leq100 the number of occurrence of 77 is 1919...7,17,27,37,47,57,67,70,71,79,87,977,17,27,37,47,57,67,70,71\cdots ,79,87,97

×

Problem Loading...

Note Loading...

Set Loading...