What are:
3 + 5 + 7 + 11 + 13 + 17 = 56
59 + 61 + 67 + 71 + 73 + 79 = 410
61 + 67 + 71 + 73 + 79 + 83 = 434
89 + 97 + 101 + 103 + 107 + 109 = 606
127 + 131 + 137 + 139 + 149 + 151 = 834
163 + 167 + 173 + 179 + 181 + 191 = 1054
211 + 223 + 227 + 229 + 233 + 239 = 1362
383 + 389 + 397 + 401 + 409 + 419 = 2398
401 + 409 + 419 + 421 + 431 + 433 = 2514
419 + 421 + 431 + 433 + 439 + 443 = 2586
449 + 457 + 461 + 463 + 467 + 479 = 2776
599 + 601 + 607 + 613 + 617 + 619 = 3656
601 + 607 + 613 + 617 + 619 + 631 = 3688
631 + 641 + 643 + 647 + 653 + 659 = 3874
647 + 653 + 659 + 661 + 673 + 677 = 3970
701 + 709 + 719 + 727 + 733 + 739 = 4328
761 + 769 + 773 + 787 + 797 + 809 = 4696
863 + 877 + 881 + 883 + 887 + 907 = 5298
919 + 929 + 937 + 941 + 947 + 953 = 5626
947 + 953 + 967 + 971 + 977 + 983 = 5798
953 + 967 + 971 + 977 + 983 + 991 = 5842
1009 + 1013 + 1019 + 1021 + 1031 + 1033 = 6126
1033 + 1039 + 1049 + 1051 + 1061 + 1063 = 6296
1091 + 1093 + 1097 + 1103 + 1109 + 1117 = 6610
1151 + 1153 + 1163 + 1171 + 1181 + 1187 = 7006
1153 + 1163 + 1171 + 1181 + 1187 + 1193 = 7048
1163 + 1171 + 1181 + 1187 + 1193 + 1201 = 7096
1217 + 1223 + 1229 + 1231 + 1237 + 1249 = 7386
1259 + 1277 + 1279 + 1283 + 1289 + 1291 = 7678
1291 + 1297 + 1301 + 1303 + 1307 + 1319 = 7818
1361 + 1367 + 1373 + 1381 + 1399 + 1409 = 8290
1423 + 1427 + 1429 + 1433 + 1439 + 1447 = 8598
1427 + 1429 + 1433 + 1439 + 1447 + 1451 = 8626
1433 + 1439 + 1447 + 1451 + 1453 + 1459 = 8682
1447 + 1451 + 1453 + 1459 + 1471 + 1481 = 8762
1451 + 1453 + 1459 + 1471 + 1481 + 1483 = 8798
1453 + 1459 + 1471 + 1481 + 1483 + 1487 = 8834
1459 + 1471 + 1481 + 1483 + 1487 + 1489 = 8870
1487 + 1489 + 1493 + 1499 + 1511 + 1523 = 9002
1523 + 1531 + 1543 + 1549 + 1553 + 1559 = 9258
1567 + 1571 + 1579 + 1583 + 1597 + 1601 = 9498
1571 + 1579 + 1583 + 1597 + 1601 + 1607 = 9538
1601 + 1607 + 1609 + 1613 + 1619 + 1621 = 9670
1609 + 1613 + 1619 + 1621 + 1627 + 1637 = 9726
1697 + 1699 + 1709 + 1721 + 1723 + 1733 = 10282
1699 + 1709 + 1721 + 1723 + 1733 + 1741 = 10326
1723 + 1733 + 1741 + 1747 + 1753 + 1759 = 10456
1733 + 1741 + 1747 + 1753 + 1759 + 1777 = 10510
1871 + 1873 + 1877 + 1879 + 1889 + 1901 = 11290
1873 + 1877 + 1879 + 1889 + 1901 + 1907 = 11326
1901 + 1907 + 1913 + 1931 + 1933 + 1949 = 11534
1979 + 1987 + 1993 + 1997 + 1999 + 2003 = 11958
2029 + 2039 + 2053 + 2063 + 2069 + 2081 = 12334
2063 + 2069 + 2081 + 2083 + 2087 + 2089 = 12472
2131 + 2137 + 2141 + 2143 + 2153 + 2161 = 12866
2137 + 2141 + 2143 + 2153 + 2161 + 2179 = 12914
2143 + 2153 + 2161 + 2179 + 2203 + 2207 = 13046
2221 + 2237 + 2239 + 2243 + 2251 + 2267 = 13458
2237 + 2239 + 2243 + 2251 + 2267 + 2269 = 13506
2267 + 2269 + 2273 + 2281 + 2287 + 2293 = 13670
2293 + 2297 + 2309 + 2311 + 2333 + 2339 = 13882
2339 + 2341 + 2347 + 2351 + 2357 + 2371 = 14106
2371 + 2377 + 2381 + 2383 + 2389 + 2393 = 14294
2503 + 2521 + 2531 + 2539 + 2543 + 2549 = 15186
2521 + 2531 + 2539 + 2543 + 2549 + 2551 = 15234
2557 + 2579 + 2591 + 2593 + 2609 + 2617 = 15546
2609 + 2617 + 2621 + 2633 + 2647 + 2657 = 15784
2657 + 2659 + 2663 + 2671 + 2677 + 2683 = 16010
2663 + 2671 + 2677 + 2683 + 2687 + 2689 = 16070
2683 + 2687 + 2689 + 2693 + 2699 + 2707 = 16158
2693 + 2699 + 2707 + 2711 + 2713 + 2719 = 16242
2699 + 2707 + 2711 + 2713 + 2719 + 2729 = 16278
2731 + 2741 + 2749 + 2753 + 2767 + 2777 = 16518
2837 + 2843 + 2851 + 2857 + 2861 + 2879 = 17128
2909 + 2917 + 2927 + 2939 + 2953 + 2957 = 17602
2917 + 2927 + 2939 + 2953 + 2957 + 2963 = 17656
3019 + 3023 + 3037 + 3041 + 3049 + 3061 = 18230
3037 + 3041 + 3049 + 3061 + 3067 + 3079 = 18334
3061 + 3067 + 3079 + 3083 + 3089 + 3109 = 18488
3083 + 3089 + 3109 + 3119 + 3121 + 3137 = 18658
3121 + 3137 + 3163 + 3167 + 3169 + 3181 = 18938
3163 + 3167 + 3169 + 3181 + 3187 + 3191 = 19058
3203 + 3209 + 3217 + 3221 + 3229 + 3251 = 19330
3257 + 3259 + 3271 + 3299 + 3301 + 3307 = 19694
3307 + 3313 + 3319 + 3323 + 3329 + 3331 = 19922
3313 + 3319 + 3323 + 3329 + 3331 + 3343 = 19958
3343 + 3347 + 3359 + 3361 + 3371 + 3373 = 20154
3371 + 3373 + 3389 + 3391 + 3407 + 3413 = 20344
3449 + 3457 + 3461 + 3463 + 3467 + 3469 = 20766
3491 + 3499 + 3511 + 3517 + 3527 + 3529 = 21074
3529 + 3533 + 3539 + 3541 + 3547 + 3557 = 21246
?
from
DefDbl A-Z
Dim fct(20, 1), crlf$
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
For i = 1 To 500
tot = tot + prm(i)
If i >= 6 Then
If i > 6 Then tot = tot - prm(i - 6)
f = factor(tot)
nf = 1
For j = 1 To f
nf = nf * (fct(j, 1) + 1)
Next
If nf = 8 Then
For j = i - 5 To i
If j > i - 5 Then Text1.Text = Text1.Text & " +"
Text1.Text = Text1.Text & Str(prm(j))
Next
Text1.Text = Text1.Text & " = " & Str(tot) & crlf
DoEvents
End If
End If
Next
Text1.Text = Text1.Text & "done"
DoEvents
End Sub
Function prm(i)
Dim p As Long
Open "17-bit primes.bin" For Random As #111 Len = 4
Get #111, i, p
prm = p
Close 111
End Function
Function prmdiv(num)
Dim n, dv, q
If num = 1 Then prmdiv = 1: Exit Function
n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0
If limit <> Int(limit) Then limit = Int(limit + 1)
dv = 2: GoSub DivideIt
dv = 3: GoSub DivideIt
dv = 5: GoSub DivideIt
dv = 7
Do Until dv > limit
GoSub DivideIt: dv = dv + 4 '11
GoSub DivideIt: dv = dv + 2 '13
GoSub DivideIt: dv = dv + 4 '17
GoSub DivideIt: dv = dv + 2 '19
GoSub DivideIt: dv = dv + 4 '23
GoSub DivideIt: dv = dv + 6 '29
GoSub DivideIt: dv = dv + 2 '31
GoSub DivideIt: dv = dv + 6 '37
Loop
If n > 1 Then prmdiv = n
Exit Function
DivideIt:
Do
q = Int(n / dv)
If q * dv = n And n > 0 Then
prmdiv = dv: Exit Function
Else
Exit Do
End If
Loop
Return
End Function
Function nxtprm(x)
Dim n
n = x + 1
While prmdiv(n) < n
n = n + 1
Wend
nxtprm = n
End Function
Function factor(num)
diffCt = 0: good = 1
nm1 = Abs(num): If nm1 > 0 Then limit = Sqr(nm1) Else limit = 0
If limit <> Int(limit) Then limit = Int(limit + 1)
dv = 2: GoSub DivideIt
dv = 3: GoSub DivideIt
dv = 5: GoSub DivideIt
dv = 7
Do Until dv > limit
GoSub DivideIt: dv = dv + 4 '11
GoSub DivideIt: dv = dv + 2 '13
GoSub DivideIt: dv = dv + 4 '17
GoSub DivideIt: dv = dv + 2 '19
GoSub DivideIt: dv = dv + 4 '23
GoSub DivideIt: dv = dv + 6 '29
GoSub DivideIt: dv = dv + 2 '31
GoSub DivideIt: dv = dv + 6 '37
If INKEY$ = Chr$(27) Then s$ = Chr$(27): Exit Function
Loop
If nm1 > 1 Then diffCt = diffCt + 1: fct(diffCt, 0) = nm1: fct(diffCt, 1) = 1
factor = diffCt
Exit Function
DivideIt:
cnt = 0
Do
q = Int(nm1 / dv)
If q * dv = nm1 And nm1 > 0 Then
nm1 = q: cnt = cnt + 1: If nm1 > 0 Then limit = Sqr(nm1) Else limit = 0
If limit <> Int(limit) Then limit = Int(limit + 1)
Else
Exit Do
End If
Loop
If cnt > 0 Then
diffCt = diffCt + 1
fct(diffCt, 0) = dv
fct(diffCt, 1) = cnt
End If
Return
End Function
If you exclude 1 and the number itself as factors:
What are
11 + 13 + 17 + 19 + 23 + 29 = 112
41 + 43 + 47 + 53 + 59 + 61 = 304
193 + 197 + 199 + 211 + 223 + 227 = 1250
241 + 251 + 257 + 263 + 269 + 271 = 1552
271 + 277 + 281 + 283 + 293 + 307 = 1712
607 + 613 + 617 + 619 + 631 + 641 = 3728
911 + 919 + 929 + 937 + 941 + 947 = 5584
1021 + 1031 + 1033 + 1039 + 1049 + 1051 = 6224
1621 + 1627 + 1637 + 1657 + 1663 + 1667 = 9872
2011 + 2017 + 2027 + 2029 + 2039 + 2053 = 12176
2411 + 2417 + 2423 + 2437 + 2441 + 2447 = 14576
2879 + 2887 + 2897 + 2903 + 2909 + 2917 = 17392
?
by changing the appropriate line to
If nf = 10 Then
|
Posted by Charlie
on 2015-02-16 09:19:51 |