unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* even more math
@ 2022-12-10  9:06 Emanuel Berg
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2022-12-10  9:06 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-10  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-10  9:06 even more math Emanuel Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).