N is both a a palindrome and a sum of eleven consecutive positive integers.
How many possible values for N exist below 80,000?
Please provide the lowest and the highest samples.
There are 166 in the given range.
palindromic sequence
sum start end
66 1 11
77 2 12
88 3 13
99 4 14
121 6 16
242 17 27
363 28 38
484 39 49
616 51 61
737 62 72
858 73 83
979 84 94
1001 86 96
1111 96 106
1221 106 116
1331 116 126
1441 126 136
1551 136 146
1661 146 156
1771 156 166
1881 166 176
1991 176 186
2002 177 187
2112 187 197
2222 197 207
2332 207 217
2442 217 227
2552 227 237
2662 237 247
2772 247 257
2882 257 267
2992 267 277
3003 268 278
3113 278 288
3223 288 298
3333 298 308
3443 308 318
3553 318 328
3663 328 338
3773 338 348
3883 348 358
3993 358 368
4004 359 369
4114 369 379
4224 379 389
4334 389 399
4444 399 409
4554 409 419
4664 419 429
4774 429 439
4884 439 449
4994 449 459
5005 450 460
5115 460 470
5225 470 480
5335 480 490
5445 490 500
5555 500 510
5665 510 520
5775 520 530
5885 530 540
5995 540 550
6006 541 551
6116 551 561
6226 561 571
6336 571 581
6446 581 591
6556 591 601
6666 601 611
6776 611 621
6886 621 631
6996 631 641
7007 632 642
7117 642 652
7227 652 662
7337 662 672
7447 672 682
7557 682 692
7667 692 702
7777 702 712
7887 712 722
7997 722 732
8008 723 733
8118 733 743
8228 743 753
8338 753 763
8448 763 773
8558 773 783
8668 783 793
8778 793 803
8888 803 813
8998 813 823
9009 814 824
9119 824 834
9229 834 844
9339 844 854
9449 854 864
9559 864 874
9669 874 884
9779 884 894
9889 894 904
9999 904 914
10901 986 996
11011 996 1006
12221 1106 1116
13431 1216 1226
14641 1326 1336
15851 1436 1446
17171 1556 1566
18381 1666 1676
19591 1776 1786
20702 1877 1887
21912 1987 1997
22022 1997 2007
23232 2107 2117
24442 2217 2227
25652 2327 2337
26862 2437 2447
28182 2557 2567
29392 2667 2677
30503 2768 2778
31713 2878 2888
32923 2988 2998
33033 2998 3008
34243 3108 3118
35453 3218 3228
36663 3328 3338
37873 3438 3448
39193 3558 3568
40304 3659 3669
41514 3769 3779
42724 3879 3889
43934 3989 3999
44044 3999 4009
45254 4109 4119
46464 4219 4229
47674 4329 4339
48884 4439 4449
50105 4550 4560
51315 4660 4670
52525 4770 4780
53735 4880 4890
54945 4990 5000
55055 5000 5010
56265 5110 5120
57475 5220 5230
58685 5330 5340
59895 5440 5450
61116 5551 5561
62326 5661 5671
63536 5771 5781
64746 5881 5891
65956 5991 6001
66066 6001 6011
67276 6111 6121
68486 6221 6231
69696 6331 6341
70807 6432 6442
72127 6552 6562
73337 6662 6672
74547 6772 6782
75757 6882 6892
76967 6992 7002
77077 7002 7012
78287 7112 7122
79497 7222 7232
166 done
DefDbl A-Z
Dim crlf$, low, high, tot
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
low = 1: high = 11
For i = low To high
tot = tot + i
Next
Do
DoEvents
If tot > 80000 Then Exit Do
If isPalin(tot) Then
Text1.Text = Text1.Text & mform(tot, "####0") & mform(low, "####0") & mform(high, "####0") & crlf
ct = ct + 1
End If
high = high + 1: tot = tot + high
tot = tot - low: low = low + 1
Loop
Text1.Text = Text1.Text & crlf & ct & " done"
End Sub
Function isPalin(n)
s$ = LTrim(Str(n))
good = 1
For i = 1 To Len(s$) / 2
If Mid$(s$, i, 1) <> Mid$(s$, Len(s$) + 1 - i, 1) Then good = 0: Exit For
Next
isPalin = good
End Function
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
|
Posted by Charlie
on 2015-11-11 10:27:25 |