```Author: bandsmer (Michael Bandsmer)
Date: 2003-Nov-03 18:46:48

This thread is actually a continuation of the previous one, whose length
was getting a tad unwieldy.  To summarize that thread, Mikhael and Jason
have given two beautiful solutions to the problem "Express any integer >= 0
using only three 2's (combined with 'common' mathematical functions)."

While I was trying to solve the puzzle, I came up with a different
solution, which I am making into a new puzzle, formulated as follows:

Express any integer >= 0 using ONLY A SINGLE 2.

Here are some hints:

* To express integers > 2, only 2 different trigonometric functions are
needed.

* To express integers < 2, only 2 different trigonometric functions are
needed, but they are different than the ones needed for the "> 2" case.

* The solutions are independent of whether you're using radians, degrees,
etc.  Thus, the solutions are unambiguous.

* There's nothing magic about the number "2"---any other positive integer
would work equally well.

* The trigonometric functions I would consider valid are sin, cos, tan,
csc, sec, cot, and their inverses (asin, acos, atan, acsc, asec, and acot).
If you feel so inclined, you can use other common operations as well
(+,-,*,/,^,!,log,ln,sqrt), although I don't think they're necessary.

I'll follow Mikhael's practice of posting new hints daily, until I post the
solution Nov 7.  Enjoy!

Author: tomc (Tom Carmichael)
Date: 2003-Nov-03 20:53:11

And to think I just posted in the other thread that I wanted to see this.
I guess my wish will be granted, eventually.  :-)

Tom

Author: bandsmer (Michael Bandsmer)
Date: 2003-Nov-04 16:51:54

As promised, here's my hint for today:

Can you express sqrt(5) using a single 2 and trig functions?  If you can do
this, then you're well on your way to solving the puzzle for all integers n
> 2.

Author: tomc (Tom Carmichael)
Date: 2003-Nov-04 21:58:47

That was a good hint, I got the answer.  Amazing what can be done with a
single 2.

I've also got a geometric interpretation of the answer, for when it gets
posted.  I'll say this much:  my interpretation is hardly original.  :-)

Enjoy!

Tom

Author: migo (Mikhael Goikhman)
Date: 2003-Nov-05 01:36:10

I solved the hint (i.e. now I am able to express 5 using two 2's), but
I can't see the way to the original task yet. Hopefully tomorrow I will
have time to use Google to learn something new about trigonometry.
Today I learned what is csc. :))))

Author: jason (Jason Jordan)
Date: 2003-Nov-05 06:33:42

I agree, great hint - I now know two straightforward solutions for n >= 2.
I also have 8 solutions for n = 0, and 4 solutions for n = 1.

Very interesting puzzle!

-------------------------------------------------------------------------

Author: migo (Mikhael Goikhman)
Date: 2003-Nov-05 14:43:41

Nope, Google didn't help to find a trigonometric formula to reduce one 2.
I now know two ways to express any sqrt(n) using only one "1" or one "2".
This is probably the same solution that Mike initialy reported in the
previous thread when he said about "any number using ONLY TWO 2's".
But the task, I guess, is to express it using only one 2. :)

Author: shinji (RJP)
Date: 2003-Nov-05 14:57:22

Yea, google doesn't do trig (not yet at least).  Just basic math for now.

Author: bandsmer (Michael Bandsmer)
Date: 2003-Nov-05 17:29:40

Mikhael, you're really close to the solution.  You wrote

> I now know two ways to express any sqrt(n) using only one "1" or one "2".

My hint is: What happens when n is a perfect square?

Anyway, with today's hint, I don't think any more hints will be necessary,
so I'll post the solution tomorrow.

Author: migo (Mikhael Goikhman)
Date: 2003-Nov-05 20:51:59

shinji: I hope you don't mean I use Google as a calculator. :)
I have enough calculators at home, both in software and hardware.
(You also don't need a calculator with perl.  perl -e 'print sqrt(2) ** 2')
I use Google to find knowledge on Internet and learn.

Michael: ah, cool, now I know all solutions mentioned here. :)

It is amazing that I didn't disallow the trigonometry functions in my
original puzzle (I actually wanted to do this before posting the rules),
we would miss such nice new puzzle.

Author: shinji (RJP)
Date: 2003-Nov-05 22:50:58

No, I don't use google as a calculator.  I have a TI83 graphing calculator
that I use on a daily basis.

Author: bandsmer (Michael Bandsmer)
Date: 2003-Nov-06 20:10:25

Here is the solution, in case anyone hasn't worked it out yet.  First,
convince yourself of the identity

sec(atan(t)) = sqrt(t^2 + 1)

This should be obvious from the diagram below.

/|
sqrt(t^2+1) / |
/  | t
/___|
1

With this identity, we have

sec(atan(2)) = sqrt(5)
sec(atan(sec(atan(2)))) = sqrt(6)
sec(atan(sec(atan(sec(atan(2)))))) = sqrt(7)

To get an integer n > 2, use n^2-4 iterations of sec(atan()).

Similarly, you can show that
tan(asec(t)) = sqrt(t^2 - 1),
from which we can get 1 and 0 with a suitable number of iterations.

Note that other methods are possible.  E.g. csc(acot(t)) = sqrt(t^2 + 1)
can be used instead of sec(atan(t)); and cot(acsc(t)) = sqrt(t^2 - 1) can
be used instead of tan(asec(t)).

Also, we don't have to start at 2; we can start at any other integer, even
0.  Thus, this solution can be used as an "all-in-one" solution for any
puzzle of the form "express <some integer> using <some other integer>", as
long as trig functions are allowed. :-)

Finally, I'll briefly mention Tom's geometric interpretation: The method
using sec(atan()) can be thought of as constructing a spiral of right
triangles, using the hypotenuse of one triangle as the base of the next.
Starting with a side length of 2, for example, the first 2 triangles would
be constructed like this:

_.
_-~/|
.-~  / |
\/\/ _| 2
1 \/_|_|
1

The resulting spiral has some name which I can't remember, and was
apparently used by an ancient civilization to generate irrational line
lengths.

Mike
```