To read a WordPress blog in chronological order, simply add ?order=asc to the end of URL.
— Me@2025-12-09 01:21:29 PM
.
.
2025.12.11 Thursday (c) All rights reserved by ACHK

If WordPress keeps opening the block editor instead of the Classic Editor, simply add
&classic-editor
to any edit URL such as
post.php?post=123&action=edit&classic-editor
and hit Enter to instantly open the Classic Editor.
— Me@2025-12-06 07:59:41 AM
.
.
2025.12.06 Saturday (c) All rights reserved by ACHK
e28a :: Integer e28a = 1 + sum [4*(n-2)^2 + 10*(n-1) | n <- [3, 5 .. 1001]] e28b :: Integer e28b = let n = 500 sumSquares = n*(n+1)*(2*n+1) `div` 6 sumLinear = n*(n+1) `div` 2 in 16*sumSquares + 4*sumLinear + 4*n + 1
λ> :set +s λ> e28a 669171001 (0.00 secs, 617,688 bytes)
λ> e28b 669171001 (0.00 secs, 82,400 bytes) λ>
— Me@2025-11-17 12:00:22 AM
.
.
2025.11.17 Monday (c) All rights reserved by ACHK

You think you know when you learn, are more sure when you can write, even more when you can teach, but certain when you can program.
— Alan Perlis
.
.
2025.10.13 Monday ACHK
Understanding the Euler-Lagrange Operator
.
Let and
be two Lagrangian-like functions of a local tuple,
be a local-tuple transformation function, and
a constant.
Demonstrate the following properties:
a.
…
d.
~~~
Eq. (1.167):
Eq. (1.174):
.
— Me@2025-05-30 03:40:41 PM
.
Prove that
…
— Me@2025-05-31 01:32:05 PM
.
.
2025.06.03 Tuesday (c) All rights reserved by ACHK
p_27 = -(2 * a - 1) * (a ^ 2 - a + 41) where n = 1000 m = head $ filter (\x -> x ^ 2 - x + 41 > n) [1 ..] a = m - 1
Euler Problem 27 asks us to find a quadratic equation of the form that generates the most consecutive prime numbers starting from
, with the constraints
and
. The final answer is the product
for the winning pair. The “official” Haskell solution looks cryptic, but there’s a clever trick behind it. Let’s break it down step-by-step in a way that’s easier to follow.
Imagine we tweak our quadratic by replacing
with
. When we expand it out, we get:
This is still a quadratic in , but now the coefficients are:
By choosing the right , we can transform any quadratic into a simpler form, like
or
. This is our starting point.
So, is our golden ticket. But there’s more to it.
Here’s a cool trick with :
This means if gives a prime (like 47), then
(i.e.,
) does too (also 47). The sequence works both ways—positive and negative
. Starting at
, we get 40 primes up to
, but we can also count backward with negative
. Our goal is to shift this quadratic so we capture more of these primes from
onward, while keeping
and
within the problem’s limits.
Let’s start with (where
) and shift it using our trick:
The problem says and
, so:
The second condition is trickier because grows fast. We need the biggest
where
.

Let’s test some values:
So, is the largest value that works. Now calculate:
Check the constraints:

That’s where this funky code comes in:
n = 1000 m = head $ filter (\x -> x ^ 2 - x + 41 > n) [1 ..] a = m - 1
It finds (first
where
). Then
.
The final line:
p_27 = -(2 * a - 1) * (a ^ 2 - a + 41)
This is a bit off. It uses , but we need
. The correct product should be:
The code’s formula seems to be a typo or a leftover from a different derivation. It should just compute .

With , the quadratic
generates 71 primes from
to
. This shift captures more of the
sequence’s primes in the positive direction, thanks to the negative
. The product -59231 is the answer.
This solution is sneaky—it starts with a prime-generating champ, shifts it just right, and fits the problem’s rules. It’s not the brute-force way (testing every and
), but a math shortcut that lands on the perfect answer. Pretty cool, right?
— Me@2025-03-24 12:25:20 PM
.
.
2025.03.30 Sunday (c) All rights reserved by ACHK
According to Harold Abelson, one of the authors of “Structure and Interpretation of Computer Programs” (SICP), LISP can be seen as the fixed point of the process of defining a programming language, where the language itself can be used to define itself. This concept is analogous to the Y combinator in lambda calculus, which finds the fixed point of a function.

Drawing from this analogy, if LISP is considered the fixed point of the process of defining a programming language:

Therefore, according to the conceptual framework laid out by the authors of SICP, Paul Graham’s Y Combinator could be seen as the fixed point of the entrepreneurial process, where the methodology, culture, and success of one startup generation informs and shapes the next, creating a self-sustaining cycle of innovation and growth. This interpretation is not explicitly stated by Abelson or Sussman but is a logical extension of their ideas applied to business and innovation ecosystems.
— Me@2024-12-30 07:37:41 PM
.
.
2025.03.14 Friday (c) All rights reserved by ACHK

(defparameter *primes-up-to-1000* (let ((sieve (make-array 1001 :element-type 'bit :initial-element 0))) (loop for i from 2 to 1000 when (zerop (sbit sieve i)) do (loop for j from (* i i) to 1000 by i do (setf (sbit sieve j) 1))) (loop for i from 2 to 1000 when (zerop (sbit sieve i)) collect i))) (defun primep (n) (cond ((<= n 1) nil) ((<= n 1000) (member n *primes-up-to-1000*)) (t (loop for p in *primes-up-to-1000* while (<= (* p p) n) never (zerop (mod n p)))))) (defun prime-sequence-length (a b) (loop for n from 0 while (primep (+ (* n n) (* a n) b)) count t)) (defun find-best-quadratic-coefficients (&optional (max-a 1000) (max-b 1000)) (loop with best-length = 0 with best-a = 0 with best-b = 0 for a from (- max-a) to max-a do (loop for b in *primes-up-to-1000* when (> b max-b) do (loop-finish) do (let ((len (prime-sequence-length a b))) (when (> len best-length) (setf best-length len best-a a best-b b)))) finally (return (list best-length best-a best-b)))) (defun euler-27 () (destructuring-bind (len a b) (find-best-quadratic-coefficients) (format t "Sequence length: ~d, a: ~d, b: ~d~%" len a b) (* a b))) (defun main () (time (format t "Answer: ~d~%" (euler-27))))
; SLIME 2.28 CL-USER> (main) Sequence length: 71, a: -61, b: 971 Answer: -59231 Evaluation took: 0.103 seconds of real time 0.103747 seconds of total run time (0.103637 user, 0.000110 system) 100.97% CPU 258,919,169 processor cycles 0 bytes consed NIL CL-USER>
— Me@2025-02-23 03:48:23 PM
.
.
2025.02.23 Sunday (c) All rights reserved by ACHK
Structure and Interpretation of Classical Mechanics
.
…
2. On the other hand, the path function and the path function
are not necessarily the same. Explain.
…
4. Write programs to illustrate the behavior.
~~~
(pp Gamma) (define ((f-bar q) t) (f ((Gamma q) t))) (define ((Gamma-bar h-bar) local) ((h-bar (osculating-path local)) (time local))) (define (q t) (sin t)) (define (f-bar q) (D q)) (define p (literal-function 'q)) (show-expression ((f-bar p) 't))
(show-expression ((osculating-path ((Gamma p) 't_0)) 't))
(show-expression ((Gamma-bar f-bar) ((Gamma p) 't)))
(define ((GammaBar-fBar-o-Gamma f-bar) q) (compose (Gamma-bar f-bar) (Gamma q))) (show-expression (((GammaBar-fBar-o-Gamma f-bar) p) 't))
Two paths that have the same local description up to the
-th derivative are said to osculate with order-
contact. For example, a path and the truncated power series representation of the path up to order
have order-
contact; if fewer than
derivatives are needed by a local-tuple function, the path and the truncated power series representation are equivalent.
(define (g-bar q) ((expt D 3) q)) (show-expression ((Gamma p) 't))
(show-expression ((g-bar p) 't))
(show-expression ((osculating-path ((Gamma p) 't_0)) 't))
(show-expression (((GammaBar-fBar-o-Gamma g-bar) p) 't))
— Me@2024-10-16 10:34:35 AM
.
.
2025.02.16 Sunday (c) All rights reserved by ACHK
Lisp = Process(Lisp), 1.3
.

YCombinator = a fixed point of
Lisp = Process(Lisp)
So
Lisp = Y(Process)
— Me@2025-01-09 01:09:57 PM
.
Actually, it is
Lisp_n = Process(Lisp_(n-1))
— Me@2024-12-30 10:43:36 AM
.
.
2025.02.13 Thursday (c) All rights reserved by ACHK
import Data.List (elemIndex, maximumBy) import Data.Ord (comparing) import Data.Maybe (fromJust) recurringCycle :: Int -> Int recurringCycle d = remainders 1 [] where remainders r rs | r == 0 = 0 | s `elem` rs = 1 + fromJust (elemIndex s rs) | otherwise = remainders ((r * 10) `mod` d) (s : rs) where s = r `mod` d p26 :: Int p26 = fst $ maximumBy (comparing snd) [(n, recurringCycle n) | n <- [1,3..999], n `mod` 5 /= 0]
λ> :set +s λ> p26 983 (0.11 secs, 29,770,480 bytes) λ>
— Me@2025-02-06 08:29:54 AM
.
.
2025.02.06 Thursday (c) All rights reserved by ACHK

(defun recurring-cycle (d) "Calculate the length of the recurring cycle for 1/d." (labels ((remainders (d r rs) (if (eql r 0) 0 (let ((s (mod r d))) (if (member s rs) (1+ (position s rs)) (remainders d (* 10 s) (cons s rs))))))) (remainders d 1 nil))) (defun p26 () "Find the number below 1000 with the longest recurring cycle in its decimal representation." (let* ((results (loop :for n :from 1 :to 999 collect (cons n (recurring-cycle n)))) (max-pair (reduce #'(lambda (a b) (if (> (cdr a) (cdr b)) a b)) results))) (car max-pair)))
; SLIME 2.28 CL-USER> (p26) 983 CL-USER>
— Me@2025-01-20 03:57:23 PM
.
.
2025.01.20 Monday (c) All rights reserved by ACHK
Lisp as a Y combinator
.

This concept ties into:
Sussman’s statement is both a philosophical and practical insight into the nature of Lisp, highlighting its self-referential capabilities and the elegance of its design in terms of theoretical computer science concepts like fixed points.
— Me@2024-12-30 10:45:35 AM
.
.
2025.01.17 Friday (c) All rights reserved by ACHK
showtime : false$ t0 : elapsed_real_time()$ t: 10^999$ j : 1$ while fib(j) < t do ( j: j + 1 )$ j; t1: elapsed_real_time()$ time_taken: t1-t0$ print("Time taken:", float(time_taken), "seconds");
4782 "Time taken:"0.4299999999999997"seconds"
— Me@2025-01-13 08:11:23 AM
.
.
2025.01.13 Monday (c) All rights reserved by ACHK
Structure and Interpretation of Classical Mechanics
.
…
2. On the other hand, the path function and the path function
are not necessarily the same. Explain.
3. Give examples where they are the same and where they are not the same.
…
~~~
…
In other words, path for all
. Or put it simply,
is a polynomial.
.
The second case is when the path function requires no derivatives of
with order higher than
. For example:
Assume that the path is , the osculating path is
and .
Then ; and
.
== a taylor series with finite length
.
However, if a path function requires a higher derivative which is not provided by
:
,
then ; and
— Me@2025-01-12 06:43:55 AM
.
.
2025.01.12 Sunday (c) All rights reserved by ACHK
Lisp as a Y combinator
.

Lisp is the fixed point of the process which says, if I know what Lisp was and substituted it in for eval and apply and so on, on the right-hand sides of all those recursion equations, then if it was a real good Lisp, is a real one then the left-hand side would also be Lisp.
— Gerald Jay Sussman
.
Process: This refers to the act of defining or implementing Lisp. Specifically, it’s about defining Lisp’s core functions like eval and apply which are crucial for interpreting and executing Lisp code.
— Me@2024-12-30 10:45:35 AM
.
.
2025.01.10 Friday (c) All rights reserved by ACHK

import System.CPUTime import Text.Printf (printf) import Data.List (findIndex) time :: (Show a) => a -> IO a time result = do start <- getCPUTime let computed = result end <- computed `seq` getCPUTime let diff = (fromIntegral (end - start)::Float)/(10^12) printf "Result: %s\n Time taken: %.6f seconds\n" (show computed) diff return computed matrixMultiply :: Num a => [(a, a)] -> [(a, a)] -> [(a, a)] matrixMultiply [(a11, a12), (a21, a22)] [(b11, b12), (b21, b22)] = [ (a11*b11 + a12*b21, a11*b12 + a12*b22) , (a21*b11 + a22*b21, a21*b12 + a22*b22) ] matrixPower :: Num a => [(a, a)] -> Int -> [(a, a)] matrixPower m 1 = m matrixPower m n = let half = matrixPower m (n `div` 2) squared = matrixMultiply half half in if odd n then matrixMultiply squared m else squared digitsInNumber :: (Show a, Integral a) => a -> Int digitsInNumber = length . show fibNth :: Integral a => a -> a fibNth n | n <= 2 = 1 | otherwise = fst $ head $ matrixPower [(1, 1), (1, 0)] (fromIntegral (n - 1)) fibUpperBound :: Int -> Integer fibUpperBound digitCount = let phi = 1.618033988749895 logPhi = logBase 10 phi log5 = logBase 10 5 in ceiling $ (fromIntegral digitCount - 1 + (log5 / 2)) / logPhi binarySearchFibIndex :: Int -> Maybe Integer binarySearchFibIndex digitCount = let upperBound = fibUpperBound digitCount binarySearch left right | left > right = Nothing | otherwise = let mid = left + (right - left) `div` 2 midFib = fibNth mid midDigits = digitsInNumber midFib in case compare midDigits digitCount of EQ -> let prevDigits = digitsInNumber $ fibNth (mid - 1) in if prevDigits < digitCount then Just mid else binarySearch left (mid - 1) LT -> binarySearch (mid + 1) right GT -> binarySearch left (mid - 1) in binarySearch 1 upperBound
λ> time $ binarySearchFibIndex 1000 Result: Just 4782 Time taken: 0.000852 seconds Just 4782 λ>
λ> time $ binarySearchFibIndex 1000 Result: Just 4782 Time taken: 0.006747 seconds Just 4782 λ>
— Me@2024-12-25 07:00:13 AM
.
.
2025.01.01 Wednesday (c) All rights reserved by ACHK
A First Course in String Theory
.
The generating function is an infinite product:
.
To evaluate the infinite product, you can use wxMaxima. However, it does not provide rendering of answers yet. Instead, you can call
Maxima‘s code in SageMath, if you use Jupyter Notebook to access SageMath.
reset()
%display latex
maxima('taylor((1/x)*product((1 + x^(r - 1/2))^32 / (1 - x^r)^8, r, 1, oo), x, 0, 6)')
— Me@2024-12-02 06:33:46 AM
.
.
2024.12.31 Tuesday (c) All rights reserved by ACHK
You must be logged in to post a comment.