Project Euler #225: Tribonacci non-divisors

Sort by

recency

|

24 Discussions

|

  • + 0 comments

    Hints:

    1. What is 'S mod N' when N is a divisor of S?

    2. Learn that modulo arithmetic means: (a + b + c) mod N == (a mod N + b mod N + c mod N) mod N

    3. Do you need to calculate the full values of large tribonacci numbers?

    4. A non-divisor cannot go on forever without repeating. Can you detect a cycle?

    Let me know if these give away too much!

  • + 1 comment

    according to the example the first term which is not divisible by any term in series is 13 next is 23 and third term is 27 but how did he say that first term is 27

  • + 0 comments

    first of all we need to know till how many terms do we need to check but they didn't mention it naaaa....

  • + 0 comments

    How many terms needs to generate to check for the divisibility? I didn't see it mentioned anywhere. Please help!

  • + 0 comments

    Scanner obj = new Scanner(System.in); int t1= obj.nextInt(); int t2 = obj.nextInt(); int t3 = obj.nextInt(); // int k = obj.nextInt(); int d=t3+t1+t2; int x=3; int[] a = new int[100000]; for(int i=5;i<100000;i++) { a[i] = d; t1=t2; t2=t3; t3=d;

            d=t1+t2+t3;
    
        }
        for(int l=5;l<100000;l++)
        {
            for(x=3;x<100000;)
            {
               if(a[l]%x==0)
                    break;
                x=x+2;
            }
        }
        System.out.println(x);
    

    What's wrong in this?