这是什么数学系列,方程式是什么?
What sort of Math series is this, what's the equation?
我无法弄清楚这个系列的实际公式或名称是什么:
3:5; 4 : 10 ; 5 : 15;等..
代码如下:
i = 4
n = 2
while i <= granularity and i != 3:
if (i == granularity):
return 5 * n
n += 1
i += 1
return 5
这里是我用来解决这个系列的更多代码:
def getChartData(self, sym, timescale="last_day", intraday="Y", granularity="3", ytdate="False", extdhrs="n"):
dateMin = ""
dateMax = ""
alt = "hi" if timescale == "last_hi" else "lo" if timescale == "last_lo" else "cl" if timescale == "last_cl" else ""
href = ""
content = ""
sorted_content = {}
def granFac():
gran = int(granularity)
i = 4
n = 2
while i <= gran and i != 3:
if (i == gran):
return (dt.now() - td(minutes=(5 * n))).strftime("%Y/%m/%d-%H:%M:%S")
n += 1
i += 1
return (dt.now() - td(minutes=5)).strftime("%Y/%m/%d-%H:%M:%S")
序列 5, 10, 15, 20, 25, 30, ...
可以描述为 arithmetic sequence。
所以答案很可能是两个建议的组合。结果是一个范围从 3 开始并增加 1 的函数,以及一个从 5 开始设置为 5 的倍数的定义域。
function { 3, 4, 5.. }( 5 | {} )
-or-
function { x ≥ 3, x ∈ Z+ }( {x|x ∈ Z+, x≡0 (mod 5)} )
根据你来自哪个人群,似乎有几种写法。
我是如何找到答案的:
我无法弄清楚这个系列的实际公式或名称是什么:
3:5; 4 : 10 ; 5 : 15;等..
代码如下:
i = 4
n = 2
while i <= granularity and i != 3:
if (i == granularity):
return 5 * n
n += 1
i += 1
return 5
这里是我用来解决这个系列的更多代码:
def getChartData(self, sym, timescale="last_day", intraday="Y", granularity="3", ytdate="False", extdhrs="n"):
dateMin = ""
dateMax = ""
alt = "hi" if timescale == "last_hi" else "lo" if timescale == "last_lo" else "cl" if timescale == "last_cl" else ""
href = ""
content = ""
sorted_content = {}
def granFac():
gran = int(granularity)
i = 4
n = 2
while i <= gran and i != 3:
if (i == gran):
return (dt.now() - td(minutes=(5 * n))).strftime("%Y/%m/%d-%H:%M:%S")
n += 1
i += 1
return (dt.now() - td(minutes=5)).strftime("%Y/%m/%d-%H:%M:%S")
序列 5, 10, 15, 20, 25, 30, ...
可以描述为 arithmetic sequence。
所以答案很可能是两个建议的组合。结果是一个范围从 3 开始并增加 1 的函数,以及一个从 5 开始设置为 5 的倍数的定义域。
function { 3, 4, 5.. }( 5 | {} )
-or-
function { x ≥ 3, x ∈ Z+ }( {x|x ∈ Z+, x≡0 (mod 5)} )
根据你来自哪个人群,似乎有几种写法。
我是如何找到答案的: