DECLARE FUNCTION sod# (x#)
DEFDBL A-Z
'CLS
FOR n = 0 TO 13 * 99999999 STEP 13
IF sod(n + 1) MOD 13 = 0 AND sod(n + 2) MOD 13 = 0 THEN
ct1 = ct1 + 1
IF ct1 <= 5 THEN PRINT n, n + 1, n + 2, "p-1"
END IF
IF sod(n - 1) MOD 13 = 0 AND sod(n + 1) MOD 13 = 0 THEN
ct2 = ct2 + 1
IF ct2 <= 5 THEN PRINT n - 1, n, n + 1, "p"
END IF
IF sod(n - 1) MOD 13 = 0 AND sod(n - 2) MOD 13 = 0 THEN
ct3 = ct3 + 1
IF ct3 <= 5 THEN PRINT n - 2, n - 1, n, "p+1"
END IF
NEXT
FUNCTION sod (x)
s = 0
st$ = LTRIM$(STR$(x))
FOR i = 1 TO LEN(st$)
s = s + VAL(MID$(st$, i, 1))
NEXT
sod = s
END FUNCTION
The output was limited to 5 each of two of the varieties of solution as the "p-1" and "p+1" types were so much more common:
which one
p-1 p p+1 was itself divisible
by 13
75998 75999 76000 p-1
156999 157000 157001 p+1
192998 192999 193000 p-1
273999 274000 274001 p+1
390999 391000 391001 p+1
426998 426999 427000 p-1
507999 508000 508001 p+1
543998 543999 544000 p-1
624999 625000 625001 p+1
660998 660999 661000 p-1
38999999 39000000 39000001 p
155999999 156000000 156000001 p
156999998 156999999 157000000 p
272999999 273000000 273000001 p
273999998 273999999 274000000 p
So the minimum p for A1 is 157000; for A2 is 75999; and for A3 is 39000000.
In each case, the two not themselves divisible have sod's divisible by 13.
Similarly for 11:
which one
p-1 p p+1 was itself divisible
by 11
5599999 5600000 5600001 p+1
11899998 11899999 11900000 p-1
15499999 15500000 15500001 p+1
21799998 21799999 21800000 p-1
25399999 25400000 25400001 p+1
31699998 31699999 31700000 p-1
35299999 35300000 35300001 p+1
41599998 41599999 41600000 p-1
45199999 45200000 45200001 p+1
51499998 51499999 51500000 p-1
None are found where p is divisible by 11 and the surrounding numbers' sod's divisible by 11.
So minimum p for B1 is 5600000; B2 is 11899999; and none is in sight for B3.
|
Posted by Charlie
on 2013-03-18 15:05:17 |