Jump to content

Recommended Posts

  • Replies 88
  • Created
  • Last Reply

Top Posters In This Topic

I can remember the question and I can remember the answer (even after 40 years) but the route twixt the two is a little foggy.

I know you start off with

3 * (a[sub]n[/sub]10[sup]n[/sup] + a[sub]n-1[/sub]10[sup]n-1[/sup] + ... + a[sub]1[/sub]10 + a[sub]0[/sub]) = 2 * (a[sub]n-1[/sub]10[sup]n[/sup] + a[sub]n-2[/sub]10[sup]n-1[/sup] + ... + a[sub]0[/sub]10 + a[sub]n[/sub])

if that helps :D
I [b]think[/b] understand what you're saying Barand, however, did you write the Sigma in the correctly on the right side?  Should it be
2 * (a[sub]n-1[/sub]10[sup]n[/sup] + a[sub]n-2[/sub]10[sup]n-1[/sup] + ... + a[sub]0[/sub]10 + a[sub]-1[/sub])
?


I dunno, I'm only in high school Calculus, but I'm afraid I'm trying to over-complicate it. However, I must admit, it does look like some tangent function, at least from what I could tell from looking at all the numbers. Asymptotes are at x=0 and x=5. Am I on the right path?
The last term should be a[sub]n[/sub] as that is the digit that was moved from the first position to the last.

If I remember correctly, the solution went like this, but I remember you finally have to divide 3*10[sup]n[/sup] by 17, so I'm not sure how to get rid of that annoying  "2*a[sub]n[/sub]"

3 * (a[sub]n[/sub]10[sup]n[/sup] + a[sub]n-1[/sub]10[sup]n-1[/sup] + ... + a[sub]1[/sub]10 + a[sub]0[/sub]) = 2 * (a[sub]n-1[/sub]10[sup]n[/sup] + a[sub]n-2[/sub]10[sup]n-2[/sup] + ... + a[sub]0[/sub]10 + a[sub]n[/sub])
   
Let X = a[sub]n-1[/sub]10[sup]n-1[/sup] + ... + a[sub]1[/sub]10 + a[sub]0[/sub],

then

3 * a[sub]n[/sub]10[sup]n[/sup] + 3*X = 2*10*X + 2*a[sub]n[/sub]

3 * a[sub]n[/sub]10[sup]n[/sup] - 2*a[sub]n[/sub] = 17*X

Hmm, okay. Makes sense... kinda.

I guess I'll have to see if my calc teacher can get it. He can do crazy things in his head.

And btw, - Someone posts a Simple - Intermediate PHP challenge. IS one of the rules... but I don't think you broke it, the PHP isn't hard... its the math getting to the PHP that is :P

Nice workaround for the rules :P
If nobody else is setting a challenge, how about creating a function that compare two poker hands and returns the winning hand?

The function could either accept two arguments where a hand is submitted in the form "3h7d9cJhAs" or each card could be submitted as an individual argument?
[quote author=steviewdr link=topic=119299.msg507829#msg507829 date=1169133842]
It would be easier if it was Texas Holdem, as there would only be 2 cards that the player have. Quite do-able tho, if I had the time.

-steve
[/quote]

Well how about a function for Texas Holdem then where you enter 7 arguments, 5 community cards and the 2 players cards and the function returns a point value for the best hand that can be created, this point value can the be compared against the points returned from another players hand to see who would win?
I don't think anyone knows, so if know one gets it, here is another challenge to maybe pick it up again:

Create a strtoupper function without using any function that will uppercase a letter. This should be able to uppercase anything, and ever letter.
I am happy someone finally gave a challenge that is short and fair...

[code]<?php

function upper($str)
{
$letters = str_split($str);
$new = array();
foreach ($letters as $char)
{
if($char >= ord("a")  &&  $char <= ord("z");
$char = chr(ord($char) - 32);
$new[] = $char;
}

return implode("", $new);
}

?>[/code]

Next challenge- Make a function that will do the same job as [url=http://www.php.net/manual/en/function.trim.php]trim()[/url] does (without using trim, rtrim, ltrim or chop) - Remove all kinds of spaces from the begining and end of a string, as written in the manual.

Orio.

[code]
<?php
function my_trim($str,$charlist)
{
$str = ereg_replace(" ","",$str);
                if(!empty($charlist) || $charlist != '')
              {
                  if(is_array($charlist))
                  {
                    foreach($charlist as $char)
                      $str = ereg_replace($char,"",$str);
                  }
                  else
                    $str = ereg_replace($char,"",$str);
}
                  return $str;
}
$trim = "LOT OF SPACES HERE            WOOT    FOR  SPACES    ";
echo my_trim($trim,'');
?>
[/code]

Pretty simple but it removes all spaces from a phrase.  It can be tested here [url=http://www.startrekrpg.com/ajax/trim.php]www.startrekrpg.com/ajax/trim.php[/url]

PS> I read on trim that you can use choose what characters you want to remove specifically.  So with this function you can pass an array of characters that you wish to remove or just one.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.