Questions tagged [mod]

For questions related with the *mod operation*, that can arise in Cryptography, Number Theory, Hashing, etc..

In computing, the modulo operation finds the remainder after division of one number by another (sometimes called modulus). Given two positive numbers, a (the dividend) and n (the divisor), a modulo n (abbreviated as a mod n) is the remainder of the Euclidean division of a by n.

437 questions
-3
votes
3 answers

How to implement modulo-2 binary division in c++

Right now I want to implement cyclic redundancy check in c++ so I wanna know how can I perform mod 2 binary division. Well although I know that there is a string algorithm for the mod-2 binary div but I want to know if there is any int…
Vaibhav Bisht
  • 87
  • 2
  • 14
-3
votes
1 answer

How to decrypt a shifted message with XOR?

I have a message m that I encrypt by the code c = m xor [m<<6] xor [m<<10] (m<>6] xor [c>>10]…
BOSAnonym
  • 9
  • 1
-3
votes
1 answer

Can not use modPow() on int? (Java)

My Code: public static void verschluesseln(int m) { if(m < n) { int c = m.modPow((int) n, oeffentlicherSchluessel[0]); } Error: .java:51: error: int cannot be dereferenced int c = m.modPow((int) n,…
-3
votes
2 answers

Go through the array back and forth

We have an array of some length(say 3) and some counting sequence: 0,1,2,3,4,... to infinity. Out of that input sequence we need to produce sequence that will traverse through array back and forth, like that: 0,1,2,1,0,1,2,1,0,... and so on for a…
-3
votes
2 answers

Using Apache mod rewrite to modify a query string

I know it is possible to use mod rewrite in my htaccess Take: http://example.com/directory/perlscript.pl?base64encodedquery=jhfkjdshfsdf78fs8y7sd8 Make a shorter URL: http://example.com/? whatever just want to make it prettier Incoming: I am using…
Stephanie
  • 1
  • 2
-3
votes
1 answer

Biginteger % (mod)

My code's assignment is to show if a number does divide with numbers 1-12 or not. If it does then it should print ("1"), if not ("0"). Example: Input == 6; Output == 111001000000; The problem is that "%" does not work with BigInteger's. I have…
waynekenoff
  • 47
  • 1
  • 6
-3
votes
1 answer

what is advantage of total conversion modding instead of developing a all new game?

I only have a very little experience at game dev. I've done some proof of concept academic work in unreal engine for a university project. My questions are What is advantage of total conversion modding instead of developing a all new game? And I…
-3
votes
3 answers

c++ about looping , wrong output

I just started to study C++, and I want to ask why my simple code's output is not right. What I want: user input N -> output = " N number that mod 2 =0 but not mod 3=0" What I got: user input N -> output = " number that mod 2 but not mod3=0 , with…
Atika
  • 13
  • 3
-4
votes
1 answer

Tried to find if a number entered by a user is odd or even, but it given invalid syntax

I had tried to figure out the problem using different techniques, but the problem persist. #-*-coding:utf8;-*- #qpy:console print("Welcome to number checking program") number = int(input("Please enter the number that you to want check: ")) if…
Markus
  • 3
  • 2
-4
votes
1 answer

Why is this if-condition always excluding 2?

I created this loop to find prime numbers, the int num is initialized as 0, but the debugger always skips 1 (which is correct) and 2 (which is not correct). How does it come that it always skips 2 % 2 == 0 ? for (int num = 0; num <= 100; num++) { …
kebabjoe
  • 1
  • 1
-4
votes
2 answers

How do the definitions of *, / and % guarantee that a/b * b + a%b == a?

This is true according to Straustrup in PPP, page 68. Using algebra I can reduce it to a/b * b + a%b == a a + a%b == a, // b in numerator and denominator cancel each other But that still doesn't explain the proof.
etonw
  • 9
  • 2
-4
votes
1 answer

How can I determine the value of 4^(4^(10^9))%9^9 in C++14?

I've tried big mod algorithm successfully with numbers like 9^(10^9). But when the power is also too much big to use, how to get the final answer? #include #include #define ULL unsigned long long using namespace std; ULL mod(ULL…
Samnan Rahee
  • 31
  • 1
  • 7
-5
votes
1 answer

How to set conditions in a Haskell List Comprehension

Im trying to generate a list of all Numbers bigger than 0 with the following conditions: all elements are odd all elements divide trough 7 without remainder all elements divide trough 9 with remainder 3 e.g. [21,147,273,399,...] I tried : [x |…
-5
votes
2 answers

Why is the modulus operator giving wrong answer?

#include #include #include using namespace std; int main(){ stringstream ss; ss << 32; string str = ss.str(); cout << str << endl << str[0] << endl << str[1] <
vatsal
  • 109
  • 2
  • 12
-6
votes
2 answers

How can I calculate a list modulo a numer in python?

In Python I have a list: [11,42,122,1919, 17, 4] and want to calculate its modulo a number (e.g. 10) to give the result as a list: [1,2,2,9,7,4]
J.Doe
  • 281
  • 4
  • 12
1 2 3
29
30