Let ⌈x⌉ denote the smallest integer greater than or equal to x. The sequence (ai) is defined as follows: a1=1, and for all i≥1,
ai+1=min(7⌈(ai+1)/7⌉, 19⌈(ai+1)/19⌉)
Compute a100.
Assuming [] is the ceil() function
a_100 is 525
[0, 1, 7, 14, 19, 21, 28, 35, 38, 42, 49, 56, 57, 63, 70, 76, 77, 84, 91, 95, 98, 105, 112, 114, 119, 126, 133, 140, 147, 152, 154, 161, 168, 171, 175, 182, 189, 190, 196, 203, 209, 210, 217, 224, 228, 231, 238, 245, 247, 252, 259, 266, 273, 280, 285, 287, 294, 301, 304, 308, 315, 322, 323, 329, 336, 342, 343, 350, 357, 361, 364, 371, 378, 380, 385, 392, 399, 406, 413, 418, 420, 427, 434, 437, 441, 448, 455, 456, 462, 469, 475, 476, 483, 490, 494, 497, 504, 511, 513, 518, 525]
525
------------
import math
a = 1
ans = [0,1]
for i in range(2,101):
x = min(7*math.ceil((a+1)/7), 19*math.ceil((a+1)/19))
ans.append(x)
a=x
print(ans)
print(ans[100])
|
Posted by Larry
on 2024-12-10 13:23:18 |