![]() |
![]() |
#1 |
Mar 2018
10338 Posts |
![]()
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? Last fiddled with by enzocreti on 2020-03-03 at 10:14 |
![]() |
![]() |
![]() |
#2 | |
"Dylan"
Mar 2017
599 Posts |
![]() Quote:
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:
-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 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. |
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Twin Primes with 128 Decimal Digits | tuckerkao | Miscellaneous Math | 2 | 2020-02-16 06:23 |
cubes congruent to 2^n (mod 215) | enzocreti | enzocreti | 1 | 2020-02-14 16:56 |
N congruent to 2^2^n mod(2^2^n+1) | enzocreti | enzocreti | 2 | 2020-02-12 15:14 |
Congruent to 10^n mod 41 | enzocreti | enzocreti | 0 | 2020-01-09 11:56 |
((my) mod n ) congruent to n-1 | smslca | Math | 2 | 2012-01-29 11:30 |