(defun c:qz ()
(if (= cal nil)
(arxload (findfile "geomcal.arx"))
)
(setq i (getreal "\ni值:"))
(setq i (1+ i))
(setq n (getint "\n计算次数:"))
(setq m n)
(setq n (cal (strcat (rtos i) "^" (rtos n))))
(while (/= m 1)
(setq m (1- m))
(setq n (cal (strcat (rtos n)"+"(rtos i)"^"(rtos m))))
)
)
如i=3 n=4 结果=340 本帖最后由 mandala 于 2011-6-27 15:35 编辑
i和n的值是需要输入的是吧?
(defun c:test(/ i n x y z)
(setqi (getreal"输入i值:"))
(setq n (getint"输入n值"))
(setq x 0
y 1)
(repeat n
(setq z (expt (+ 1 i ) y))
(setq x (+ x z))
(setq y (1+ y))
)
(print x)
)
如果i=5,n=5 ,结果为9330。
(defun c:test ()
(setq i (getreal "\ni值:"))
(setq n (getint "\n计算次数:"))
(setq d (1+ i)
k 0
)
(repeat n
(setq k (* d (1+ k)))
)
(princ (rtos k))
(princ)
) (i-1)[(i+1)^n-1] 回复 nzl1116 的帖子
这个公式不对 (1+i)[(1+i)^n -1]/i skynoon 发表于 2011-6-27 21:57 static/image/common/back.gif
(1+i)[(1+i)^n -1]/i
厉害,是这个公式,学习了...... 测试计算正确,支持4楼
页:
[1]
2