Call the first k digits 'a' and the last 3 digits 'b'.
(Solution for N below in bold is a 999 digit number with k=996 and b=200)
n = 1000a + b 100 <= b <= 999
2n = 2000a + 2b
2n = (10^k)*b + a
1999 a = (10^k - 2)*b
a = b * (10^k - 2) / 1999
1999 / (10^k - 2) ~~ 1.999 ยท 10^(3-k)
For k > 3, the value of (10^k - 2) / 1999 is between
5.002401 * 10^(k-4) and 5.002502 * 10^(k-4)
a/b = (10^k - 2)/1999
Note that 1999 is prime
Series: 8, 98, 998, 9998, 99998 etc mod 1999 is
8, 98, 998, 3, 48, 498, 1000, 23, ....
And this finally reaches 0 if k = 996, or 1995, or 2994, or 3993
So for k = 996
(10^996 - 2)/1999 equals (thank you to Full Precision Calculator)
50025012506253126563281640820410205102551275637818909454
72736368184092046023011505752876438219109554777388694347
17358679339669834917458729364682341170585292646323161580
79039519759879939969984992496248124062031015507753876938
46923461730865432716358179089544772386193096548274137068
53426713356678339169584792396198099049524762381190595297
64882441220610305152576288144072036018009004502251125562
78139069534767383691845922961480740370185092546273136568
28414207103551775887943971985992996498249124562281140570
28514257128564282141070535267633816908454227113556778389
19459729864932466233116558279139569784892446223111555777
88894447223611805902951475737868934467233616808404202101
05052526263131565782891445722861430715357678839419709854
92746373186593296648324162081040520260130065032516258129
06453226613306653326663331665832916458229114557278639319
65982991495747873936968484242121060530265132566283141570
78539269634817408704352176088044022011005502751375687843
92196098049024512256128064032016008004002
This is 993 digits. We must multiply it by a 3 digit number so that the number of digits becomes 996. Times 100 for example is too small, this would only be 995 digits. 199 gets close but the smallest 3 digit number that will work is 200.
a = 200 times the 993 digit number above; and then b is 200
The final number is N =
100050025012506253126563281640820410205102551275637818909
454727363681840920460230115057528764382191095547773886943
471735867933966983491745872936468234117058529264632316158
079039519759879939969984992496248124062031015507753876938
469234617308654327163581790895447723861930965482741370685
342671335667833916958479239619809904952476238119059529764
882441220610305152576288144072036018009004502251125562781
390695347673836918459229614807403701850925462731365682841
420710355177588794397198599299649824912456228114057028514
257128564282141070535267633816908454227113556778389194597
298649324662331165582791395697848924462231115557778889444
722361180590295147573786893446723361680840420210105052526
263131565782891445722861430715357678839419709854927463731
865932966483241620810405202601300650325162581290645322661
330665332666333166583291645822911455727863931965982991495
747873936968484242121060530265132566283141570785392696348
174087043521760880440220110055027513756878439219609804902
451225612806403201600800400200
Multiplying this by 2 yields:
200100050025012506253126563281640820410205102551275637818
909454727363681840920460230115057528764382191095547773886
943471735867933966983491745872936468234117058529264632316
158079039519759879939969984992496248124062031015507753876
938469234617308654327163581790895447723861930965482741370
685342671335667833916958479239619809904952476238119059529
764882441220610305152576288144072036018009004502251125562
781390695347673836918459229614807403701850925462731365682
841420710355177588794397198599299649824912456228114057028
514257128564282141070535267633816908454227113556778389194
597298649324662331165582791395697848924462231115557778889
444722361180590295147573786893446723361680840420210105052
526263131565782891445722861430715357678839419709854927463
731865932966483241620810405202601300650325162581290645322
661330665332666333166583291645822911455727863931965982991
495747873936968484242121060530265132566283141570785392696
348174087043521760880440220110055027513756878439219609804
902451225612806403201600800400
Input: f(N)
Output: 2.0
-----------------------------
def f(n):
s = str(n)
new = int( s[-3:] + s[:-3] )
return new/n
for n in range(1000,10000):
s = str(n)
new = int( s[-3:] + s[:-3] )
if new/n == 2:
print(n, new, new/n)
for k in range(1,11):
print(k, 10**k - 2, (10**k - 2)%1999 )
mymodvals = [8]
modval = 8
for k in range(2,10000):
modval = (9*10**(k-1) + modval)%1999
if modval == 0:
print(k, modval)
mymodvals.append(modval)
print(mymodvals[:10])
-----
1 8 8
2 98 98
3 998 998
4 9998 3
5 99998 48
6 999998 498
7 9999998 1000
8 99999998 23
9 999999998 248
10 9999999998 499
996 0
1995 0
2994 0
3993 0
4992 0
5991 0
6990 0
7989 0
8988 0
9987 0
[8, 98, 998, 3, 48, 498, 1000, 23, 248, 499]
|
Posted by Larry
on 2024-03-23 08:33:37 |