Jump to content

HFD

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.designersvault.net

Profile Information

  • Gender
    Not Telling

HFD's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for all your replies I've changed a few things around, and I've now implemented the layout properly with my PHP/MySQL code. There's still lots of changes to be made (although I consider the homepage pretty much complete), but I'm pretty close to completion. Any more advice from you guys? Thanks Note: the site is now at http://www.designersvault.net rather than http://www.designersvault.net/new
  2. Thanks for your reply I've got the bad habit of using internal stylesheets then moving to an external one later, so that'll be changed soon. Ah yes upon testing in other browsers I've noticed the problem with the Designers Vault text too, I think it's because I was messing around with the letter spacing . I'll use your advice to help improve it, thanks.
  3. Hi, I'm currently creating a new design for my website, Designers Vault and I'm wondering what people think so. Here's the link: http://designersvault.net/new/ It's not finished yet, but what do you guys thinks so far? Is there anything you'd add/remove/change? Thanks
  4. Thanks, that works great just one last question - I'd like to be able to fully comprehend what the program does (I'm not completely familiar with PHP) so can I just ask what the $exponent >>= 1 and $exponent & 1 signify? I'm not familiar with these expressions. Again, thanks very much.
  5. Right, I just figured out that my method that I'm using seems completely wrong So I guess a final question (which has nothign to do with PHP, sorry:p) is how would you break down these equations so they are easy to perform? For example I also have to do 2668^3473 (mod 5063) which would of course prove impossible by hand...Thanks
  6. Thanks for your reply again, I've just tested that and it works perfect so thanks this is for coursework though and we are required to understand the theory that when carrying out modular exponentiation that after every power/multiplication, if you mod the number by the modulus you are using, and carry out the next multiplication on the newly 'modded' number, and repeat that until you finish all the multiplications required in the exponentiation. So to perhaps show that I understand the theory I'm wondering if it's possible to do it that way in PHP... For example, in this 614^17 mod 5063... 1: 614 * 614 = 376 996 376996 mod 5063 = 2334 2: 2334 * 2334 = 5447556 5447556 mod 5063 = 4831 And carry this out 17 times in total, after all the exponentiation is done. If I'm being completely confusing no worries, as the code you gives works fine I could just use that
  7. Thanks for your reply, I'm just testing the BCMath extensions now as they are installed on my server. But, I'm a bit as I am using this method of exponentiation because it uses significantly less memory (after every multiplication, it applies mod 5063 to that number, then carries out the next, modding that number too...etc), and I was told in theory the PC should never have to compute large numbers at once with this method. Or perhaps I'm just thinking of it wrong EDIT: BCMath returns the same wrong result...but, I've noticed something rather stupid in my code. I was multiplying $num1 by $num2 which was wrong, as it should be simply $num1 * $num1 - I've amended this but still have the wrong answer...is there anything else I've missed? Thanks
  8. Hi, sorry for the large amount of posts lately but I need more help I need to be able to work out very large powers with mod n - so for example, at the moment I'm testing 614^17 (mod 5063). So far I have this script: <?php $num1 = 614; $num2 = 17; $mod = 5063; $answer; for ($i = 0; $i < $num2; $i++) { $answer = $num1 * $num2; $answer = $answer % $mod; $num1 = $answer; } echo $num1; echo "<br />"; echo $num2; echo "<br /><b>"; echo $answer; ?> However, I've calculated the value that the answer should be, and verified it with others, and the server is not outputting the correct values. The answer should be 2668, but the server does not return this value - I've also tried changing the < $num2 in the for loop to <= $num2, etc but to no avail. Any ideas? Thanks
  9. Thanks for your replies I've currently been adapting the code to work with my current prime algorithm, just to stay consistent - I have the following <?php $num = $_POST['number']; $factors = array(); $i = 0; if ($num > 0 && $num < 10000) { for ($check = 2; $check <= sqrt($num); $check++){ if ($num % $check == 0){ $factors[$i] = $check; $num = $num / $check; $i++; } } if (count($factors) == 0) { echo "Number is prime"; } else { echo "Number is not prime! Factors are listed below"; for ($counter = 0; $counter < $factors[$counter]; $counter++) { echo "$factors[$counter] x "; } } } else { echo "Number is not between 0 and 9999!"; } ?> But it doesn't work correctly...rather than factorising as 2 * 2 * 2 * 5 * 13 as it should, it just comes out as 2 * 4 * 5...sorry to be a pain with this, maths is not my strong point
  10. Thanks for both your help guys only thing is I'm having a bit of trouble - I understand the code you guys posted and it works, but not in the way I intend it too. I'm given this example, which the program should do: 520 should factorize 2 × 2 × 2 × 5 × 13 Something like this I think : http://www.btinternet.com/~se16/js/factor.htm Thanks again
  11. Hi, I've currently written a prime test algorithm, and I want to extend it to factorise numbers into primes. For example, 55 factorises into 5 and 11. Here's part of the code I have so far for the prime testing - how would I extend this to factorise into primes? Thanks for ($check = 2; $check <= sqrt($num); $check++){ if ($num % $check == 0){ echo "This number is not prime. because $check is a factor! <a href=\"prime.php\">Try another number?</a>"; die(); } } echo "Number is prime! <a href=\"prime.php\">Try another number?</a>"; die();
  12. Ah ok thanks, the arrays should do fine
  13. Thanks only problem is in that scenario I'd have to make 25 arrays with the offsets for the different shifts - that's of course entirely possible and fine but just wondering if there's a more efficient way? Thanks
  14. Thanks for your reply. What a Caesar cipher does is increment every letter by a certain amount, so if by incrementing by two HELLO becomes JGNNQ
×
×
  • 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.