Вы находитесь на странице: 1из 8

S (n).

C
1* (c) .1993.11.13.John.C.McCarthy

"Sen) .c"
Example Implementation of A Simple Algorithm to Calculate Sen),
The Smarandache Function:
This is the code for the module.

Refer to "S(n).h" for details.

*1

#include "Sen) .h"


u_int prime[PRIMESI6+1]

II allocate storage for list of all 16-bit primes


II plus terminating zero.

void make-primes(void)
{

u_int *ppj
u_int *tPj
u_int pj
pp=primej
*pp=2j
*++pp=3j
p=5j

II ptr to last prime so far of prime list


II ptr to current test prime
II number being tested for primality
II
II
II
II
II

point to start of prime list


set first prime to 2
set second prime to 3
next possible prime. N.B. p is kept odd so that trial
division by 2 is unnecessary.
whi l'e (true) { I I inf ini te loop!:
tp=prime+lj
II point to first odd test prime
II whilst test prime <= Ip:
while(long) *tp)*(*tp)<=p) {
if(!(p%*tp { II If current test prime divides (is factor of) p:
p+=2;
II try next odd number
if(p<*pp) {
II done when p overflows:
*++pp=Oj
II terminate list
returnj
tp=prime+lj
else ++tPj

II point to first odd test prime


II Else point to next test prime

II no prime <= Ip divides p so p must be prime:


*++pp=p;
II so store it next in the list
p+=2j
II try next odd number
if(p<*pp) { II done when p overflows:
*++pp=O;
II terminate list
returnj
}
}

24

S (n) . C

void QetSF(u_lonQ n, struct SF_struct *SF)


{

u_int *pp;
u_lonQ r;

II ptr to current prime


II 'residue' of n remaininQ for factorinQ

SF->sfk=O;
r=n;
pp=prime;

II no. of distinct prime factors discovered


II point to start of prime list

II whilst current prime <= /r and prime list not exhausted:


while(lonQ) *pp)*(*pp)<=r && *pp) {
if(! (r%*pp
{
II if current prime is a factor of r:
SF->sfp[SF->sfkJ=*pp;
II store current prime as next prime of SF
SF->sfa[SF->sfkJ=l;
II set its multiplicity to 1
r/=*pp;
II 'divide out' current prime
whi1e( !(r%*pp {
II while current prime factors r:
SF->sfa(SF->sfkl++;
II increment multiplicity
r/=*pp;
II 'divide out' current prime
}

II increment count of distinct prime factors

SF->sfk++;
++PPi

if (r,> 1) {
SF->sfp[SF->sfkJ=r;
SF->sfa[SF->sfkJ=l;
SF->sfk++;

II next prime
II If
II
II
II

n contains prime) 2-16:


store it as last prime of SF
set its multiplicity to 1
increment count of distinct prime factors

25

Sen) .C
u_Iong Stu_long n)
{

struct SF_struct SF;


int sfi;
u_Iong Sn;
u_long X;

II
II
II
II
II

if(n==l) return 0;

II special case

ge t SF ( n, &SF);

II calc. and store SF of n

to store SF of n
index of current term of SF of n
current guess at Sen)
S(current term of SF of n) where it might exceed
current value of Sn.

II
II
II
II

First guess at Sen) is S(p-a), where p is the largest prime in the SF


of n and a is its multiplicity. This pre-empts the calculation of S(p-a)
for the remaining terms where, as is likely, p*a for these terms is <=
this initial guess (since S(p-a) <= p*a always):
sfi=SF.sfk-1;
Sn=Spa(SF.sfp[sfiJ ,SF.sfa[sfiJ);
while(sfi>O) { II while more term(s):
sfi"--;
II next term
if(SF.sfp[sfiJ*SF.sfa[sfiJ>Sn) { II if this term may have larger S(p-a):
x=Spa(SF.sfp(sfiJ ,SF.sfa[sfiJ);
II calc. i t
if(x>Sn) Sn=x;
II if new max., update Sn with it
}

return Sn;

II That's all folks!

u_long Spa(u_long p, int a)


{

II Refer to item 3) of the algorithm description in S(n).h.


int c; II largest multiple of p such that f(p*c, p) <= a (eventually!)
int Zj II f(p*c, p)
int mj II used to calc. no. of times p appears as factor of c
if(a<=p) return p*aj
c=a-2;
z=f(p*c, p) i
while(z>a) {
II d in items 3.2.3.1) and 3.2.3.3) of algorithm description is implicit
II here:
Z--i

m=C--i
while(! (m%p

II while p divides m:

Z--j

m/=pi

II 'divide out' factor of p from m

if(z<a) return P*(C+1)i


else return P*Cj
}

26

S(n) .C

int f(int x, int p)


{

int k=Oi
int XdPi

II count of appearance of prime p as a factor in the integers


II from 1 to x.
II successive divisions of x by p

xdp=x/pi
whl1e(xdp)O)
k+=xdpi
xdp/=pi
return ki
}

27

J"'UNCTlOOf. s( nd. for ,,-429496529' \0 ft~%'4967%'5


\5 of
IIlu.s:
~
3
%
1
ft'
14316551
279.147
10~9ZU'
21&435331
1..... "
42"'6529.
101977
517C657
1194373
5531 .29.,&5307
42,.'6530.
%7351 . . 7
110%5"
45&3741
10%%6107'
"2,4'65316 10737~13%'
57CZ7
%671
7255009
64&lot
4Z9.96532. 21.' 266,
2119163
U.3Z%51
1139Z 1
55%0521
21517
42,.96533.
90407
.3641
1911
3919 429.965,.7
42,.9653
10&907
233.
3109
158597
1.9.9
429.96535&
195137
4925419 1031655123
30971
41.
CZ'4'653.'
1199711
%79157
154573
130517
55%7
4294965376
7535U7
3003~7Z3
35172~7
%13679&7
429.9653&. 214, 2:&93
195%257
35 ... 1
%7012361
40.19
357913783
429.96539,
5117
5Z9393
%3.7
154807
%35289
429.965401
238.0111
%2138
7
ca13
IZ5997
5179
C29.,65el.
3%1n.
.04073.
lZ109
1t6ZZ3
"65117
.% 9.54Z.
U73
134217&7
1530091
7.53.3.7
42 985.3.
65.83
2&.33103
3.0.7
56"07
1787.3
,557'
.. Z... '.5 .....
70011
423191
5.7067
.Z949.545.
&3Z' 4Z '55.o157
. . . 9.
1&22U7
143 .... 33
7115ta7
18Z75037
&294965.6&
11233
1935541
157
11'40.1 ZU7"Z73.
4Z9.965.7.
1&673763
97'253
14.3.
.Z 965 ,
102Z.1083 4%"965487
lZ27133
390.51409
7158Z7583
50951
1'3&7
4% . . . . 5
255197
3804221
72091
%9483
17903
CZ9 6550.
53.87089
lZ236369
.69.0.7
357913793
"88ZUS
429.96551.
' 50,
57193 CZ 9655Z'
%52'45031
.Z9.96552. 21.7'.2763
Z . . 8371
3Z Z13
Z 1
8.919
5835551
42 9.553.
%32:1.03
187077 10737413.7
2933'
1'979
.2949.554'
za057
lZ5.9
20355Z.7
1038.37
CZ'4 555.
"4&117
Z0452217
3.7057
13174741 1031&551&.
8710'837
'Z9 655"
1130Z541
31&1037 1431655193
1518.0.
1&26&809
4% 6557.
.%.4.655'
% 3
%54'
139
19701&77
4Z'498558'
1988.1
%%6050&21
9&1783
4Z9.9.559. 117374139.
ZU'H
9283
9Z3053
531.70701
lU31l
15.373
42'.'.5&0.
5147
89.11
2957
515231 4Z . . . . 5117
42'.965.16
Z5taO'
1&Z&4Z3
416"40.
%45'
42.4.'582.
"2513
Z551
U2933 %14748Z&19 1431655%13
1177Z77
4Z94.15.31
85899313
11'707
8 78451
Z09.23
%937733
42'.96564.
1745921
147827 'Z.4.65659
ta371
Z0731
42'4'6565.
... 03393
'29.'&567
17111417
11'557
,oall O.
42'4'656'.
tata73
715&Z7613 42'.965679
Z88Z5273
42'.'65&7. 1073741419
.7721&41
Z038.Z7
.00
195Z25713 1431155ZU
CZ.4965.&6
.2 .,157
,77%184ll
1753
58741
%72'
"294'6569.
61356653
75.31
1151
594953
105.43.
4Z90 570.
1556147
889411
lU6303 Z147 Z&59
2Z.8.'
.%'.'.57lS
.783181
7009'
.Ota73
84'311
17lS613
42 6572.
7517
165190"
179
4Z9.965737
531.70717
42'496573.
121."3
650&51
63111261
1&7573
"2'49657.' 21.7 Z&73
16777Z1
ZO.52Z179
7.77
Uta%19 .2.4955757
~%9'96575.
7ZZ.
Z311
2'793
1026031 .29 . . . 5767
U 65766
4933
603.89
1112.17
140 11
Z68.35361
353.
tall
Z .... 157
84'07
.zaa3'3
U.74.2.
5760.
91'
55823
4337
429.96579.
1.3165527
116080157
%.317
41357
%3831
42,4'65.06
57527
Z165893
34.241
877111
.761
U,.9658a
S&569
4799
357.13.1.
.oaze
21%'
42'.'65.2.
15Z6&&1
71&3
5355319 4%.4.65&39
359231
.. 25 .. 9.5&36
721843
leUZ.7 .2.4915847
3'5'9 1431655Z83
.. 29 .. '65 ....
21.74&2.3
72211
14.10ZZ71
237173
7129
4Z' .. 965.56
417a7~
33353
lUst Z7 1073741 7
107069
429.'65&6.
1073741.7
306783277
'772l&~31
35749
13113
OZ 965876
Zl51
20&1903
217.
429 .. 965&&' ZI47.&29.3 .Z949658.7
14316553
513566557
a4121 2147 2.4'
19219
CZ9'965&'.
.294'65.1
110127331
1&71
31"91 1073741.77
429"85'06
103643
UUl
1C775.
75217
lZ084511
.294965.1.
tal913
5ZUl
157.401
31U
Z5.04.
429"9.5.Z.
Z1474&Z.7
130150483
ta21
7&457 42""5'37
4294 5.3.
4151
3933119 4294965'"
Z&3
74151137
42, . . . 594.
6%7.19
138547U9
1221
3&6933.7
5417
429 1595.
991909
a699
Z5U
1191061 .. Z9.9659&7
OZ 9.5915
890509
13Z1
.,838'
756'58Z1 4294965977
42''''6597'
229
%6118817
15Z5'
3&70S111
7 .. 30737
"29491559
131
.2a,
33331
5.56957
6907
CZ9'96599.
1315.
60492&79
176956917
353.8017 .%.4.66007
4% 9&6006
5939
%579
1
..
737
.15133
15101
CZ94966015
%2Z537t
254879
Z5&173
35.95587
27.511
42''''6602&
11 05&1
47197.%.
55075Z43
%%357.7
5.51Z711
42'''9.&03.
95 .... 369
Z73617
1&3003
13"2176&9
23&001
42,.96&
2788~39
590&9
2213 21474830Z'
4511
42'498.056
10 .. 75527
9.951&31135&65&1
32Z ...... '
429"96606. 21&7483033
1033
913&2257
47721 ... 53
1&2129
103613
429 .. 966076
.0139.7
3701 1.31655363
7.535.0. .2949660&7
42'''96508'
az,
'5137 4Z9.'5&099
Z05.3
'~Z76001
429"961096
233549
350&3
"9'37 10737"15Z7
.29"'6610. 21&7".3053
22171
3329.S11
13t .... l
327110' 21 .. 7 3059
429.'66116
67"Z4'
257863 "29.9.1129
73583
27 .. 9
4%.4'6.121
lZ13
2526 .. 5067
536.707&7
521 21.7 386'
42'''''&136
40009
9697
18738.7
340519
1.9394.
4%.0966146
53 7077
390051469
776.7
415&559
18573765'
U".66151
tsO 150"
.05347
Z51
155&01
1567505.
429.966161
9336.&3
2237
7"051141
4.10.7 429491&177
42''''&617.
119737
'0737
ta&37571
lU613 4Z'~"6l&7
42'49661
1022611
754.Z71
Z008.71
1 Gl Z009
.7%7'
4%.4966196
1633017
57 7
511ZZ19
%113
1063537
4%9 %06
10.53
.3.at
23740'
U5100Z1 .Z9 . . . . %17
"Z, .. 98.Z16
159673
a, 7
4.63Z3
11007
'7&7
42949&&2'Z&
24.Z71
1190071
.52.7
11219&7 .. 29 .. 9&6237
4Z94961Z38
3317
2&676&0'
UZ'U
42 966Z'. 21 .. 74&3123
56 "
13463
lZ7 . . 707
.7721&473
171401
429.9.IZ56
U3'7!tl3
6 \356611
3.1673
355573 1073741557
1635'3
4294'652
'751Z&7
7156Z7713
2'63
a755Z373
8596&1
~Z9496'Z7'
un
15417
153!tl
lO377'
16519lOll
"Z' .. ' ZI.
33Z711
261"1
3.&3333
3 . . . . 7 .. 2''''66297
4Z94'6.Z'.
91,&93
1t7663
357.1385.
251197
2"5&"&1
4Z9498.30S
5051
6074917
59.0479
to8191
Z61&&aI9
.Z 956311
159072627
"3078'
538870791
1160a0171
1571
42 3Z1
325697
llil"6.9
14116&9
1715. .Z9'966337
42'4'66336
286331"
77&13
39'03361
6&17 .. 069
1'5Z25743
'Z9498.34.
107053
75350217
&7fH 21 .. 7 3179
56&93
4Z9 .. '.6358
4Z9"9&&37
.01a&7
5&102.
Z83571 42'''9&63'7
42'4'663&.
14Z51
3904514.9
113025.31
1907
Z5Z.9
U.U66376
273043
2464123
151137
1&673766.
3851
U,.9 386
39 1
13'Z177
17.5.Z13
10136&1
32763
429"'66396
3407
41&9&703
6047
1160., 143165546'
"29496&406

P9 1

"

:~::::~n:

5
3%2U71
."41457
&65,.
9.7
4919777 2147 2&51
374125.
~%'~'65331
~ot3'163
%%8691'
12%1537
1031655117
~2'~965361 21474.26&1
357913711
lU97411
39107
%U5%Zl&1
354~9
U8'35337
377513
70&&7
6723.9
1'.611&3
15107
177477'1
5772803
287.3
308857
155108.
121313
11731
415.37
42.4965461
1696&1
88.73
71&943
2%031
7253
Z754949
1&90.313
U575.
103583
Z017
715827587
83Z519
32789
103391
Z3D66.1
852.
.9.7 9
8Z25.9
7511
2Z'3
1170.
51&2'
1037 4 013
42.4'.55.1
1&0115.
9739151
.Z9 65601 2147'8Z801
307
35527
7"5577 21474.2&11
1703Z7
U37
7 ... 039
4%.4965641
100547
6ZZ.5879
11&757
165&287.
5965Z301
42 65671
50S409
1&013
130%61
.Z.4965191
9439.
3373
72727
13%17
11&Z73
4294.65721
23057
413
1689681
ts0150.77
29173
226050&29
89669
ta755309
1000691
.77211.19
836573
lZ3774Z3
7.33
4169.697
10255'
70524&'
10627
31&00&5.7
%0789
4Z"965&Zl
53687072.
&516"1
4290.65841 %1478Z9Z1
3%7.9
95"'9
S09391
110.8103
26&435367
613566553
za031
tal737647
6&6.
366997
%5Z6.5053 2147 .. a2951
.7767
'%9'''5'11
405683
%57"
831713
.7553
139703
.,803
394757.
7925.
30&7.3213
30830727
13597
~294965'71
.11
14315553%7
117709
11333
715&27667
~29'966001
2"3769 1073741503
1970167.
.0031
1439
1160&01&3
9336&a27
320.Z7
33.3
3Z56Z29
246&3713
5"366659
940229
3&53
303617
lZ521767
357913801
1139Z4&3
306783Z93
.5733
706.0&9
455.577
14035&37
42''''66121
242173
1759
5&0 .. 0013
1328477
4153
16017&3
Z88.79
5161.31
160&7
8213.
55063619
390"51"71
2 .... 03217
Z1317991
6317
35Z133
525571
22451 .. 7
17 ... 053
30Z462"1
536870779
.2 'I6Z31
237.3
;,.239
1109
1431155 .. 17
16393001
5501
6&3
,,%53
5691
.073
.3161Z69
311
310557
727'6039
Z753
.. 7721 ... 79
139801
%%5050&5'
174337
194&'
2706343 21074&3171
5Z09
1353.7
230'1217
1 .. 66al
117877
1431655457
108&27
goa603
890333
338ta633
... 761
5557
9761Z873
ZZ067

7
231547
4294965313
%2.67729
75577
5.5&13

I
337167
113025 .. 03
2117&33
15&&9

979691
715127559
11''''l3
10~755253
641
66za033
4%'~965383
5749619 %lOHI2697
51154'
2634' 1
3.301
429.,65"13
397Z7
ZO'522163
5003
746561
n87l
Z617
H65537
13997
536&706&3
1385.7Z73
55'90Sl
COOl
'4&69 1073741371
ZS661
30509
%94337
83751.
306783251
7039
142799 10737413&1
lZ13Z671
638UZl
64319
11&31861
17599
17.6Z3
77933
11930.599
%9&801
%0507
lZ7&1
Z949839
2970239
7Z7960Z7
C0459
33Z94307
7.4.7
429.965613
3303&1971
'''09
130%689 2147 Z117
70Z7
"54'
160033
6400843
%&071671
Z092'
9336&&19
'2"965673
25~5919

23719

"2'4,&56&3

1350&&9

4ZZZS

53,.7Q723

. Z 9 . " 57.3
55555'
1431155Z71
at 037091
13.5&29
U6U
341117
4a64061
6517S
70309
5209%'
9&33
78Z9
U5941
Z243
1290157
Z571&359
1431555321
31174.
7 71
5ZCU61
1322749
471301
6537239
3637
.. 29 .. 96&0.3
23&6"9
3512&9
.. 29496&073
.. 61&2.31
10&1583
340573
1672&9
2&33333
6&57.3
79Z263
'29496&153
4294961163
6661
117'33
14965039
1&313
6719
1361
1739557
429.9662 .. 3
1160&0169
29671
%Z173%9
35537
6721387
357 .. 7
390"514&3
4936742'
.13566619
Z52645079
54133
1762399
429.966373
159072829
1057613
109001
149333

3067&3%71
1451
17.71
20719
Z38609213
1757351
4303573
255&52:73
21.74&2937
1091
69.e9783
1009
7588Z79
351931
4'&261a3
53617074'
1494421
%01'53
1990253
9U67
5%76371
3&053
131&2&3
529911
35&691
357913&37
1263ZZ531
ZI627
119& 7
7110.71
&&03
%&57
692736 .. 7
1&23
311229.3
47934.9
21 .. 74&3077
578213
96Z9969
979&7
191
Z5626Z9
%1503
5%'3'3'
40290,9
1073741561
763957
aZl
21 .. 74&3137
581&9
7 .. 051143
lZ54371
15230377
1600211
499414,9
17&956931
Z003al
1367
170557
26.435399
1 %63%25.1
357913867
1679033

113025.13
.5613
201907
130S ... 07
ta31
Z2381%7
153391633
Z492a7
4%9'965733 Z14741%867
6701
7309
142137 214,4.2&77
12lS3 1073741 1
65075239
1979246.

of

%
9

279&023
256331Q%1
2'5"2659
&5&993067

"Zl

14.3
31,29
1307
15&993077

8&357
.77239
Z46&3
10105&01
1'534S7
&5.9930&9
2207
1&&331
6079
1&&3
137593

72679
1&.417
ta~7297

12%713301
106747
.91997
7&090213
1031
337
50529007
533536 1
21a59
3061

3193Z&3
40t53

C0961
a58993133
3011
123.7
7.&0671
2&63310.7
&5&9931"3
Zl153
85 53
1553333
6270023
.... 57
65097
169.3
%16331053
'753
122713309
190&&737
.. 999
99409
733
7933
1595!
5a43491
71090289
&5&9931al
9 9a7
17179&637
3aa6a47
199Z7
lZ2713313
158993193
057
a0513
&5a993199
32497
13400&3
19219
11003

112&769
277363
16231
17179&6 .. 3
6.791
13634&13
1&33
7&090293
114532.3
234Q5&1
27709459
216331077
122713319
17179&, .. 7
&6531
365063
19976517
2163310&1
1561&059
&12&71
15070057
9323
29&Z0457
179
&5.'932~7

37347533
40904'.1
315.7
197243
397
&5&993269
55&993271.
25733
701219
737'27
19991
&5&993211
558993%&3

I'\nc::TION. S(n) . for n-4Z9.96529. &0 n-CZ9.917Z95


IJlllS:
Of
4
3
1
2
0
251
.0 9
1877
11356&131
'77
H94966411
2939
15569
7017919
4294966427
15640al
,29.96 ... Z1
261251
15913
809
17674759
37571
cZ9.9SI.3.
9651&1
1137137
1172207
3911&27 42:94'.' 7
.. 2' .. " .....
172787
202021
6567227
211427
nl61
429.96.45.
t431155.,
17970571
2 121
1301504'9
3067.3319
.61
7001
330&911
429.9 7.
3'.91 429.96 77
429491649
3455323
17&958937
513566641
19273853
H949664as
86787
4999981
49367431 21474&3249
7895159
110&3
47721&501
41&623
1153
234417
4294916505
1259551
4,.91
124193
1951
306&71
4294968511
3237
613566S47
.77211503
16777213
2251
429.9 521
396,
.. 7
160&'017
85Zl759
".Z093 2147 32&9
42'.'1653'
12271333
3023
25Z6450~1
16193
.. 2949 , ....
115191021
&4373
330312043
1129957
&910719
73&&3
42'49&6556
201547
511123
U32U
55563
347.1
4294.8&5'&
21474&329
131547309
37&93
293
1405421
OZ94~8'571
47721&51
12739
75350211
5.0"00a,
13316'
... 2949665
325.7
a&S627
... ...... 1
9717119
3.3
4294, 59.
1523
22253713
zg&2U57
5&&35159
15681
429496&1
6551
7&4501 4294966619
105323
,70131
42''''&6616
1Z~7573
23469763
45751
12064513
7~535419
4294966&25
5&21
3303&2049
?a39 4294966539
.73671
4294965131
2202547
12&1697
10&0223
2&"31
... 29.966 .... 21474.3323
a&627
139381
.121S49
17449 42949.1.57
429496 5.
.29.96667
21.309
152239
5564.7 ... Z949 67
42949 6.
6053
49941473
la97'
IZ51771
757
4Z94966675
21401
3670911 7
23&3
3.0451517
1795.
.&29.9&
.7119
1099&1
21&11751
165&21&3
536,70&37
4Z9496'6"
143115557
16976153
4492643
975907
429496&70& Z147U3353
431
201641&3
919
3607
119304&31
4Z~4'66711
144563
201 9
137&5919
&4103981
52377.43
.294'.672.
71512779
322929&3
11164549
30460757
1020117
429.9 73.
17179157
31653 14316 55513
11041
115& 11
4294"'745
47&'
191391
1299143
5811163
429496.751 18737416&9
47721853
27751 42949&6769
191
321047
4Z94966,.1
11519103
47721S531
99223
9133
1&U917
4294968771
745'
15199
34019
14&102303
14.0273
42949667.1
357U3~
1782143'
43313503 ZI47 ... 339,
17.9
42'4966796
4294966&1
204522229
32173
761
991&2'49
4294.66 1
21474&341
17&&149
359171
1515049
3257
4Z949&&lII.
350&1
1502139 4294965&29
13Z2.
29417511
429496&.2.
349753
154495Zl
1&50'
1135&6.91
4&623
4294966.31
laa7iUU
2147UHB
3m~U
7.nn
293
2909
1073741717
29~9
429496U&&
191449
26143543
9116&9
507&793
429496&171 1073741719 429.916677
3491143
1931
23633
33&213
3067&3349
42949&66&&
1135667
154423
1241363
3303620&9
429496&&96
148'
2029
176207
357913909 4Z9.96'90~
5&39
42'49669,6
1154551
&41327
&2339
109'l 9
7307
4Z9 ... 9,&91.
54,366&7
6263
572357
715127621 42949&19%7
4Z9496.,21
19522577
IS6737693
42107519
2403451
1&121
4294968,36
53923
47197439
5651%723
5990191
200&9939
4Z9.96I'.'
36497
397351
23017
353699
13&1907
429496&956
7621
97119
59&52319
226050693
70067
429496696'
9.7
26Q791
163.&7 21 ... 74&34.9
.710&.5'
4'l9496697.
9&0&1
15 963
602a.7
519.51
1255.313
.. 2949669.1
.2949.7
16330673
UI07
119159 429.966997
429 .. 96699.
143165567
1597
5&35553
65519
114&3a69
4294967006
1&0007
150053
14412&41
795217
31149
429.&967011
11606019
32537629 4294967029
1&541
23917
4294967026
201
20549
&355967
1413213
Z4.5.ll
42949.7036
5009
477211561
141319
39183
18111
.. 29.96784.
21474&353
1755197
13459
25Z645121
5347
42949&705&
1431&5519
2401143
Z599659
132967
15761
.29.9.7016
107374177
1101273&1
5250571
23761
119304641
42949670"
429496709
&13566727
1132639
4294967066 Zl47413543 .29.9670&7
362
96553
76695 1 1431&55699 Z1474.3549
.. 294'6709&
1252177
2609 1 .. 31655703
2135737
15&3
4294967101
236507
15053
75.297
1005&471
429.967116
63a"l
463319
1&1471
15639
21141
429496712& 2147 . . 3563
21474&357
159072857
1.&'7&63
13&547327
13147
.294967136
&5&99343
20.4249
2251031
13990121
9336&.51
.29.967146
647
5156023
1932059 21474&3579
429"67156 10737011719
1&4571
1793&3
1&01
3229
l'l12483
429491716.
'49&1
62929
317159
104755297
429496717.
&7"'1
143165573
5449 42949&7119
20.522247
152293
42949671"
31033
461&2443
1296007
2521 "'294967197
4294967196
25264513
"'.&Q09
1&539
113122&1
11091&9
4'l"96720'
25411
11959
523776'"
37107&1 1"'31655739
.294'672:16
13&54733
69779
10631107
22037
252645131
.29.967226
23327
70409299
2:93&9
125 .. 79
417961
42'.'67231
4111
15966421
1&77171
65543
2Ul1
.29.9672
32771
.a17
82&13 21474&3629
59652323
ot2, .. '6725.
115861
35&09
295&7
37549
357531
429496726&
127
1&046061 C294967279
11&1711
3&1851
42949&7271
22605091
1039
2069
65539
715127811
4294967266

Pale 2 of 2

\$

,,'

"

,,2'.'1.4"

4Z,., ,9.

HUUUU

23Unn

5
30199039
204522211
4294966441
2669339
19&11719
127&3

3303.2037
159072833
&13566643
1&6&1&9
345727
1210173
2307&&1
1431'55517
1190&3
25577
21577
4294966591
465711
110127349
1693
312&3'
15571
4294966651
.29.,6&661
1237
24.26397
109451
75350293
22&0'17
2194
3.'
40129
4141723
'9417
11&010183
231H19
5629"
93229
107%937
13&'951'
913&2273
3&351

nun

330362067
1431555627
1311
1137.3
1431655&37
3809215'
114755291
6297
9117
'47439
1431655657
42'.966911
,,4Z7747
110127359
22453
365747
5663
10710641
215&2749
7121
&5551
017&39
21467
111967
.29 .. ,67111
102871
12&99
1163
772U
.2,4967111
651&39
3513
82791
1157&731
477211579
39403369
4294967231
1431655747
16&4071
281
3U9
&951
"2''''967291

7
1
... 0.213
390.51493
577
&14093 14316554&1
7a301
3929521
126322543
99182"1
.".&323
19"
2176171
321143
56512717
6&06603
5413 1431655501
443
390417
39&4199
9565627
93
32611
715&27757
&135666'"
536&70&19 4294966553
517359
52377&41
5107
1&6163
2Z139003 4294966513
222953
21367993
203&9
201261
5OS&123
7993
92347
Zl2&2211
719
8597
H051149
14549
799361
1073741663
200a3
756023
10331.9
a&59207
&6477
12030719
357913&91
54366667
3.,&9
13& 54 7313
536170139 1431655571
69371
4.26&9
397
aa'043
559 .. 59
195225751
69.1,3
14913079
45411
151765&1
24265349
107021
6936557
7151277.7
3303&2061
53&&70.49
93503 1431655.11
3277. 4294966813
2907899
26511
47721.537
349911
20347
1925'941
7mn
1030n~
1327
13.5541
13&053
5.040093
911
1073741723
59791
715127&17
136.7
70051
.53199
&555711
57943
1Z7'4709
306763353 .294966943
536170&69 1431655&51
.76523&7
217.43
390451503
449
20297 1431655661
1&341
3230Z7
55.977
41060&7
21913097
'75467
17401
55.9053
37&4213
536&70179
96703
9&51
37tOl
357913921
4007
"8193
160&.019
12Z01&11
390451553
1022&1121
113323&7
9209
6a174011
66977
la463
112423
17321
12859113
10021
1 073741763
Z.76913 '29.967143
33&11639
163&1
4aa61!7
34919
9739
357913931
14717
1952257&1
29333
233.2213
26029
238609219
75167
292493
3019
&13749
3557
&191
619139
1456&1
1527371 1431655751
64103939
19867
395959
5"670909
1226763
795659
464773
331

3.9."

8
7213
12541
(1539
199
2415513
21.7 3237
1073741121
7866239
536870813
1256573
10631
2"17579
149713
23&609253
5307&7
'4&199
6170929
29&303
10737"'1&51
9061111
11719
3067&3331
153151
195225757
63997
715.27779
1073741671
102&9&1
127&263'
701
20259277
.079
36209
79&41
7566&9
306783341
17&4&1
105.3997
44&1
4021
25679
27059
2753&9
4HHn
611993
27531&39
50647
22193
2797
3271
35204&47
9151
2147 3 .. 77
10737.17'&1
715'27629

7&3.1

2147.&3497
13256071
12707003
1412&151
3392549
34636&31
2&79
564533
1779191
3422&3
21691753
5197
675097
11031
1&6669
7321
70&S3
361707
21474&35a7
6197
713.497
97612&91
859&1
172&273
31&949
450&3
"2097
262657
61111&7
46614427
2147.&3647

9
57%&6219
636763
655221
5039
151"3293
133&1

29511,7
158993299
6151
2'407
7469507

C0123
56509
32"43
1&20H21
3&4 753
943'4&7
179593
2&6331107
490573
1&901
221962\
4567
15&77
26031101
120223
5167
216331113
21&629
2111
4'l41
92.'43
.5&993349
35671
27709463
15618061
154523
7.311
317323
&1129
61291
&58993367
1579
65557
4517
2290&49
221219
9651611
95443709
6519933&3
36191
2.1a39
156993319
613
393&53
12113
41177
193
S.5&597
.5&993403
10141
85.993407
11767033
12218.9
19976591
791699
12917
395303
9199
216331141
14753
1293.7
576119
515293
151993433
7283
"4171
45210111
286331147
13109
231223
22025473
69001
4259
954.3717
17179169\
12271335\
65537

Timing of S(n).c Module for Calculation of Smarandache Function, version 1

Time taken to calculate S(n) depends on how easy it is to factor n.


Less
time is required if n has "small" prime factors.
So, in the following table,
the values of n shown are the mid-paints of ranges (n-99 thru n+99).
Times
shown are for calculating S(n) for all integers in each range 10 times over:
n

time (ms)

100
200
400
800
1600
3200
6400
12800
25600
51200
10 i4 0 0
204800
409600
819200
1638400
3276800
6553600
13107200
26214400
52428800
104857600
209715200
419430400
838860800
1677721600
3355443200

268
308
345
387
432
490
571
661
766
919
2450
4036
5670
7977
10423
13004
16302
23438
29642
37011
50330
62363
77888
108179
158480
159111

30

Timinq of S(n).c Module for Calculation of Smarandache Function, version 2


"Time to n" is the time taken to calculate S(n) for all n <= that shown.
"Time add." is the time taken to calculate S(n) for all n > previous nand
<= current n. All times are in milliseconds (as per version 1):
n

Time to n

Time add.

50000
100000
150000
200000
250000
300000
350000
400000
450000
500000
550000
600000
650000

18223
66763
139191
229634
335252
452539
579419
715146
859963
1012335
1171221
1336899
1508825
1686808
1870023
2058983
2252457
2450892
2653620
2860734
3072049
3288502
3509106
3733965
3962171
4194158
4429331
4668560
4910513
5155601
5404652
5656512
5911306
6169686
6431383
6696172
6963206
7232974
7505412
7779763
8056579
8336442
8620053
8905641
9194727
9486449
9780105
10076920
10375202
10676383

18223
48540
72428
90443
105618
117287
126880
135727
144816
152372
158886
165678
171927
177983
183215
188961
193473
198435
202728
207115
211314
216454
220603
224860
228206
231987
235173
239229
241953
245088
249051
251859
254794
258380
261697
264789
267034
269768
272438
274351
276816
279863
283611
285588
269086
291722
293655
296815
298282
301181

70(1000

750000
800000
850000
9QOOOO
950000
1000000
1050000
1100000
1150000
1200000
1250000
1300000
1350000
1400000
1450000
1500000
1550000
1600000
1650000
1700000
1750000
1800000
1850000
1900000
1950000
2000000
2050000
2100000
2150000
2200000
2250000
2300000
2350000
2400000
2450000
2500000

John McCarthy
17 Mount street
Mansfield
Notts.
NG19 7AT
United Kingdom

31

Вам также может понравиться