mersenneforum.org (https://www.mersenneforum.org/index.php)
-   enzocreti (https://www.mersenneforum.org/forumdisplay.php?f=156)
-   -   Integers congruent to last two decimal digits mod 23 (https://www.mersenneforum.org/showthread.php?t=25336)

 enzocreti 2020-03-03 10:13

Integers congruent to last two decimal digits mod 23

N belongs to Z, that is N can be every positive, negative or 0 integer.
let be m the last two digits of N

so for exampe if N=9345, m=45
is it possible to find with a program the numbers N congruent to m mod 23?
Is it possible to extend this to other primes p different from 23?

 Dylan14 2020-03-03 18:38

[QUOTE=enzocreti;538797]
is it possible to find with a program the numbers N congruent to m mod 23?
[/QUOTE]
Yes. I wrote this Python script to determine said numbers:
[CODE]#program to check if a number is congruent to its last 2 decimal digits mod p,
#where p is a prime

N = -10000
p = 23
while(N<=10000):
stringint = str(N)
finaldigits = stringint[-2:]
finaldigitsint = int(finaldigits)
if N%p == finaldigitsint:
print(N)
N += 1
else:
N += 1[/CODE]Up to |N| = 10000 I get the following numbers:
[CODE]-9918
-9822
-9703
-9607
-9511
-9415
-9319
-9200
-9104
-9008
-8912
-8816
-8720
-8601
-8505
-8409
-8313
-8217
-8121
-8002
-7906
-7810
-7714
-7618
-7522
-7403
-7307
-7211
-7115
-7019
-6900
-6804
-6708
-6612
-6516
-6420
-6301
-6205
-6109
-6013
-5917
-5821
-5702
-5606
-5510
-5414
-5318
-5222
-5103
-5007
-4911
-4815
-4719
-4600
-4504
-4408
-4312
-4216
-4120
-4001
-3905
-3809
-3713
-3617
-3521
-3402
-3306
-3210
-3114
-3018
-2922
-2803
-2707
-2611
-2515
-2419
-2300
-2204
-2108
-2012
-1916
-1820
-1701
-1605
-1509
-1413
-1317
-1221
-1102
-1006
-910
-814
-718
-622
-503
-407
-311
-215
-119
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222[/CODE]If you have a Python interpreter you can run this with a different value of p to find numbers that are congruent to their last 2 digits mod p.
That being said, it may be worth learning a coding language so you don't have to ask such questions. It's one thing for someone else to do the code, it's another to do it yourself.

 All times are UTC. The time now is 19:51.