help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

even more math


From: Emanuel Berg
Subject: even more math
Date: Sat, 10 Dec 2022 10:06:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

I saw this when we did the lambda bindings, it holds from
0 to 99 at least :)

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/geh.el

(require 'cl-lib)

(defun arith-sum (n)
  (cl-loop
    with sum = 0
    for i from 1 to (1- n)
    do (cl-incf sum i)
    finally return sum) )

(defun digs (n)
  (* n (1- n)) )

(cl-loop
  for i from 0 to 99
  while (= (digs i) (* 2 (arith-sum i)))
  finally return i)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]