OEIS A244953: Ridiculous Formula
|
08-20-2022, 08:05 PM
(This post was last modified: 08-20-2022 08:27 PM by C.Ret.)
Post: #4
|
|||
|
|||
RE: OEIS A244953: Ridiculous Formula
(08-20-2022 11:34 AM)Thomas Klemm Wrote: How about:\( \begin{align} a(n) = \frac{3n + 4 - (n \mod 4 - 2)^2}{2} \end{align} \) Very nice formula that will be efficient for large \( n \), but actually lead to a longer program than the simple original definition : \( a(n)=\begin{align}\sum_{k=0}^{n}mod(-k,4)\end{align} \) A001 LBL A A002 INPUT N A003 0 A004 RCL ST Y CHS 4 Rmdr + DSE ST Y GTO A004 A011 RTN Of course, this shorter version of the code need more time to compute a(n) for large n. PS: Step A002 is optional, it is just the equivalent of a "N=?" PROMPT operation. Just to remember the user to enter a real integer. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)