Hódító / Queosia forum
Hódító / Queosia forum
http://queosia.com
http://hodito.hu

Go Back   Hódító / Queosia forum > Hódító / Queosia forum > Általános beszélgetések > Egyéb

Egyéb Minden, ami máshova nem fér

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-22-2010, 08:42
BimmBimm's Avatar
BimmBimm BimmBimm is offline
Member
 
Join Date: Jan 2007
Location: Hódmezővásárhely
Posts: 1,448
Activity: 0%
Longevity: 95%
Default

Az általam ismert legjobb módszer, ha csak a szám gyökéig keresed az osztóit.

PHP Code:
int isprime(unsigned int n)
{
    
unsigned int i;
    
unsigned int maxi=sqrt(n);


    for (
i=2;i<=maxi;i++)
    {
        if (
n%i==0) return 0;
    }
    return 
1;

(ez c kód)
__________________
Mert ott van az erő, az egyszerű magyarban
Egyenes derékkal, áll minden viharban

BimmBimm (#233333)

Éplista számító
Reply With Quote
The Following 2 Users Say Thank You to BimmBimm For This Useful Post:
Sponsored Links
  #2  
Old 11-22-2010, 13:07
Redback's Avatar
Redback Redback is offline
Member
 
Join Date: Jun 2007
Location: Nyíregyháza
Posts: 2,975
Activity: 0%
Longevity: 92%
Default

Quote:
Originally Posted by BimmBimm View Post
Az általam ismert legjobb módszer, ha csak a szám gyökéig keresed az osztóit.

PHP Code:
int isprime(unsigned int n)
{
    
unsigned int i;
    
unsigned int maxi=sqrt(n);


    for (
i=2;i<=maxi;i++)
    {
        if (
n%i==0) return 0;
    }
    return 
1;

(ez c kód)
na megnézem ezzel

Szerk: Köszi szépen BimmBimm, egész szépen muzsikál! Pár perc alatt 30 milliónál járok Hogy ez miért nem jutott eszembe tegnap... Gugliban néztem, ott is volt gyökig osztás, de akkor nem esett le, hogy mégis miért :/
__________________
Redológia (#455305) [1/A] [SZK]

Non omnis moriar (#701164) [3/G]

Last edited by Redback; 11-22-2010 at 13:59..
Reply With Quote
The Following User Says Thank You to Redback For This Useful Post:
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:49.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Design partly based on Hódító's design by Grafinet Team Kft.

Contents and games copyright (c) 1999-2020 - Queosia, Hódító

Partnerek: Játékok, civ.hu