Notices
Results 1 to 4 of 4

Thread: Reducing the operation by using the modulo

  1. #1 Reducing the operation by using the modulo 
    Suspended
    Join Date
    Oct 2011
    Posts
    42
    i, I wonder that is there any way to disassemble this operation ((n+2^(n-2))^2 mod 1000000007) without counting 2^n-2. Please, help me.


    Reply With Quote  
     

  2.  
     

  3. #2  
    Professor of Articulation Zesterer's Avatar
    Join Date
    Nov 2011
    Location
    The fourth dimension, our universe, the milkyway, outer galactic spiral 8, the solar system, earth.
    Posts
    43
    The modulo function, mod function (programming) is often mistaken for the word modify. All it simply does is continue to subtract/add a particular number to the current one until the number becomes between 0 and the determined value. In programming syntax, we could do. (GML) a=number b=boundary_number for ab a+=b until a<b and a>0 However, it must be noted that this shall only operate for a positive number. For this equation to work, there must be a loop sequence so that the equation can continue to cancel-down the value until it reaches it's target.


    Reply With Quote  
     

  4. #3  
    Suspended
    Join Date
    Oct 2011
    Posts
    42
    Quote Originally Posted by Zesterer View Post
    The modulo function, mod function (programming) is often mistaken for the word modify. All it simply does is continue to subtract/add a particular number to the current one until the number becomes between 0 and the determined value. In programming syntax, we could do. (GML) a=number b=boundary_number for ab a+=b until a<b and a>0 However, it must be noted that this shall only operate for a positive number. For this equation to work, there must be a loop sequence so that the equation can continue to cancel-down the value until it reaches it's target.
    "mod_pow" is a function (using fast modular exponentiation) which returns the result of exponentiation modulo 1000000007 - mod_pow (the first parameter, second parameter, modulo). The first parameter is the base, and the second parameter is the exponent.
    For:
    y <- n + mod_pow (2, n-2, 1000000007).
    result <- mod_pow (y, 2, 1000000007).

    I get an incorrect result, so I had misunderstood something. Very please to explain.
    Reply With Quote  
     

  5. #4  
    New Member
    Join Date
    Nov 2011
    Posts
    2
    Quote Originally Posted by amit28it View Post
    i, I wonder that is there any way to disassemble this operation ((n+2^(n-2))^2 mod 1000000007) without counting 2^n-2. Please, help me.
    I'm not a hundred percent sure I understand your question, but in case you want to try and calculate this by hand, no, you don't have to calculate 2^(n-2).

    First of all, (
    (n+2^(n-2))^2 % 1000000007 = (n+2^(n-2)) * (n+2^(n-2)) % 1000000007
    = ((n+2^(n-2)) % 1000000007) * ((n+2^(n-2)) % 1000000007) % 1000000007
    = (n % 1000000007 + 2^(n-2) % 1000000007)) * (n % 1000000007 + 2^(n-2) % 1000000007)) % 1000000007


    Now, what you have to do is calculate ((n % 1000000007 + 2^(n-2) % 1000000007), square that and do the modulo-operation once.
    The hardest part will be calculating s = 2^(n-2) % 1000000007
    s = 2^(n-2) % 1000000007
    = ((2^30 % 1000000007) * 2^(n-2-30)) % 1000000007
    = (73741817 * 2^(n-2-30)) % 1000000007
    = (73741817 * 73741817 * 2^(n-2-30-30)) % 1000000007
    etc.

    HTH,
    Johannes
    Reply With Quote  
     

Similar Threads

  1. Operation Systems Concept help
    By Shadowsundying in forum Computer Science
    Replies: 8
    Last Post: August 2nd, 2010, 01:24 AM
  2. Anti-curl operation
    By talanum1 in forum Mathematics
    Replies: 0
    Last Post: December 28th, 2009, 04:57 AM
  3. Drag-reducing Agent
    By rowanlim in forum Mechanical, Structural and Chemical Engineering
    Replies: 1
    Last Post: September 21st, 2009, 02:49 PM
  4. Please tell me this is an Islamic black flag operation again
    By Greatest I am in forum Scientific Study of Religion
    Replies: 2
    Last Post: March 13th, 2009, 04:45 PM
  5. Reducing global temperatures using the oceans
    By ronseal86 in forum Biology
    Replies: 17
    Last Post: May 27th, 2007, 05:33 PM
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •