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
0
votes
1 answer

How to convert reminder int value to string (Characters)

How to convert int value into string means my string will be 42646 character its mod 42600 how to show and print this character and how? int count = image_length.length(); //count=42646 System.out.println(count); int mod = count % length; //46 int…
Dipa Gove
  • 23
  • 3
0
votes
0 answers

Using prime value for mod with guid key in hashing

I am using GUID (128 bit) as a key into a hashing function. Then for by table size I chose 16 so the function is like hash(guid) mod 16 which gives me the partition I need to use. The feedback I am getting is to do something like this Guid (without…
Frank Q.
  • 6,001
  • 11
  • 47
  • 62
0
votes
1 answer

Solr regex not working

Morning everybody ,, this is my first time to use solr after reading some document about q , and fq i want to make query that return all rows that have last digit equal 3 for example . I tried to use regex like condition id:/.*3/ , but this return…
0
votes
1 answer

Program should get a number from user then

I read an int numer from the user. I should calculate all numbers which have mod1 until numer is reached. The program should write them one by one. public class meraba { public static void main(String[] args) { int number; …
Jas
  • 11
  • 2
0
votes
1 answer

Square pyramidal number of Int32 modulo some M using only Int64 intermediates

Computing the square pyramidal number n (n + 1) (2 n + 1) / 6 mod M for values of n up to 10^9 (and prime M) poses a bit of a challenge because the intermediate result before modulo reduction can exceed 10^27 and can therefore be too big for a…
DarthGizka
  • 4,347
  • 1
  • 24
  • 36
0
votes
1 answer

Modular Multiplicative Inverse function in matlab

I have problem for calculate modular multiplicative inverse. example I have integer A = 151 and M = 541. 151 mod 541. inverse mod 151 to 541 is 43 how to calculate modular multiplicative inverse in matlab ?
user3752566
  • 95
  • 1
  • 7
0
votes
1 answer

C# Division expression generator - Only MOD 0s

I want to generate a set number of division questions. These questions must give an integer answer and not real number. Here's my code: int tempNum1, tempNum2; do // Cannot give decimal answers for students { …
user6609573
0
votes
1 answer

Android opengl es 2.0 timely dependant operation in shader becomes slower over time

I've written some shader code for my android application. It has some time dependant animation which work totaly fine on webgl version, shader code is below, but full version could be found here vec3 bip(vec2 uv, vec2 center) { vec2 diff =…
0
votes
1 answer

why does includeOptional not work the same as writing the code

I use apache 2.4 and I have some vhost files that have .htaccess disabled with AllowOverride None. I thought the easiest way to include .htaccess files was to include them with this line IncludeOptional…
Daemon Byte
  • 9
  • 1
  • 4
0
votes
1 answer

Using modulus operator on a char in C

I am trying to mod a char in c by using the following: int shift = 1; c = (c + shift ) % 26; printf("c= %c \n",c); The variable c is a lowercase english character between a-z. When I try to print out the char c using the above code, I get the…
Turtle
  • 1,369
  • 1
  • 17
  • 32
0
votes
1 answer

Why is Random.nextInt() %16 skewed while Random.nextInt(16) works perfectly fine?

I am writing a Bukkit plugin that treats snowballs as paintballs. When I accidentally used: (byte) (random.nextInt() % 16) instead of (byte) (random.nextInt(16)) I noticed that lower numbers appeared way more than higher numbers. Why does that…
Aly
  • 847
  • 1
  • 6
  • 30
0
votes
1 answer

How do I reverse the Mod operator

I have a simple function that handles overflows with modulus operator Private Function RandomizeBlock(seed As Integer, ByVal block() As Byte) As Byte() Dim Generator As System.Random = New System.Random(seed) Dim newblock(255) As…
SSpoke
  • 5,656
  • 10
  • 72
  • 124
0
votes
1 answer

Crash when opening a view controller with a KDCircularProgress "return mod ..."

Everytime I re-open the app, my UITableView which contains a KDCircularProgress in every cell crashes with this error. Any idea how to fix it? (it doesn't crash all the time, sometimes it works too) I think it's the value "value" which has a…
Oscar Falmer
  • 1,771
  • 1
  • 24
  • 38
0
votes
1 answer

Checking if a number is divisible by 20 MATLAB

The code below will not work because the program won't know if the trial number we are on is divisible by 20. Basically, I want to check if the trial = 20, 40, 60, etc. and if so, have the subject take a break if they wish. numTrials = 345; for…
collegesista
  • 87
  • 3
  • 12
0
votes
1 answer

Code for finding Pisano Period showing wrong output

I want to calculate Pisano Period for any integer 2 <= m <= 100000. This code is currently not working for m>4, for m>4 output showing is 9.What am I doing wrong in the below code. def fib(n): i=0 f=[] while(i<=n): f.append(i) …