Euler problem 19.1

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

(defun is-leap-year (year)
  (or (and (zerop (mod year 4))
           (not (zerop (mod year 100))))
      (zerop (mod year 400))))

(defun days-in-month (month year)
  (case month
    ((1 3 5 7 8 10 12) 31)
    ((4 6 9 11) 30)
    (2 (if (is-leap-year year)
           29
           28))))

(defun euler-19 ()
  (let ((day-of-week 2) ; 1 Jan 1901 was a Tuesday
        (sundays 0))
    (loop :for year :from 1901 :to 2000 :do
      (loop :for month :from 1 :to 12 :do
        (when (zerop day-of-week) ; 0 represents Sunday
          (incf sundays))
        (setf day-of-week
              (mod
               (+ day-of-week
                  (days-in-month month year))
               7))))
    sundays))

(print (euler-19))

CL-USER> (euler-19)
171
CL-USER> 

— Me@2024-01-30 01:46:11 PM

.

.

2024.01.30 Tuesday (c) All rights reserved by ACHK

1.9 Abstraction of Path Functions

Structure and Interpretation of Classical Mechanics

.

Given a function \displaystyle{f} of a local tuple, a corresponding path-dependent function \displaystyle{\bar f[q]} is

\displaystyle{\bar f[q] = f \circ \Gamma[q]}.

So while the input of \displaystyle{f} is a tuple \displaystyle{(t, q, v, \cdots)}, the input of \displaystyle{\bar f} is an abstract path \displaystyle{q}.

\displaystyle{\begin{aligned}  \Gamma [q] &= (t, q, v, \cdots) \\   \bar f &= f \circ \Gamma \\  \end{aligned}}

.

Given \displaystyle{\bar f} we can reconstitute \displaystyle{f} by taking the argument of \displaystyle{f}, which is a finite initial segment of a local tuple, constructing a path that has this local description, and finding the value of \displaystyle{\bar f} for this path.

1. The goal is to use \displaystyle{\bar f} to reconstitute \displaystyle{f}.

2. The argument of \displaystyle{f} is

\displaystyle{\begin{aligned}  \Gamma [q] &= (t, q, v, \cdots, q^{(n)}) \\   &= (t, q^{(0)}, q^{(1)}, \cdots, q^{(n)}) \\   \end{aligned}}

3. Assume that we have the value of the initial position of the path, \displaystyle{q_0 = q(t=0)}. Then the path \displaystyle{q(t)} can be constructed by

\displaystyle{q(t) = q_0 + v_0 t + \frac{1}{2} a_0 t^2 + ... +\frac{1}{n!} q^{(n)}_0 t^n}

Note that while \displaystyle{q} represents a path, \displaystyle{q(t)} represents the coordinates of the particle location on the path at time \displaystyle{t}.

Knowing the value of \displaystyle{q(t)} for every moment \displaystyle{t} is equivalent to knowing the path \displaystyle{q} as a whole.

— Me@2023-12-19 08:16:40 PM

.

.

2024.01.29 Monday (c) All rights reserved by ACHK

@dialectphilosophy, 1.4

Velocity is relative in the following sense:

Subjective value of an objective velocity changes under Galilean transformation. Different inertial observers would see different velocity values.

Acceleration is absolute in the following sense:

Subjective value of an objective accelerative remains unchanged under Galilean transformation. Different inertial observers would see identical acceleration values.

The proof:

\displaystyle{a' = \frac{dv'}{dt} = \frac{d}{dt} (v+v_0) = a}

In other words, the statement “acceleration is absolute” is with respect to Galilean transformation. It is not with respect to every kind of transformation. Confusing these two meanings is a major bug of @dialectphilosophy.

.

Note that Galilean transformation, like many other “transformations”, is conceptual, linguistic, mathematical, logical, coordinate, subjective, but not objective, nor physical, because the two observers are seeing the same underlying physical event.

— Me@2024-01-23 12:12:23 PM

.

.

2024.01.24 Wednesday (c) All rights reserved by ACHK

Privacy Statement

Last Updated: November 14, 2025

.

Apps Covered:

1. Keyboard Calendar
2. Keyboard Date Stamp Light
3. Keyboard Date Stamp Pro

Introduction: Our Android apps are designed to enhance user experience by storing settings locally on the device without transmitting them over the internet. We prioritize user privacy and ensure that no personal data is collected or shared.

Data Collection: We want to assure our users that our apps do not collect any personal information, such as names, email addresses, or location data. The apps solely store user preferences and settings locally on the device.

Permissions Note: In particular, Keyboard Calendar requires access to the device’s calendar (via READ_CALENDAR and WRITE_CALENDAR permissions) to enable adding events while typing; this access is local-only and does not involve data transmission.

Keyboard Date Stamp Light and Pro function as input methods and may use standard Android keyboard permissions (e.g., BIND_INPUT_METHOD). They require no special permissions beyond basic app functionality.

Data Security: We take the privacy and security of our users’ data seriously. Since our apps do not transmit any data over the internet, there is minimal risk of data breaches or unauthorized access to personal information.

App Settings Backup: As a default Android setting, the apps allow backup of local app data via the device’s backup service (e.g., to Google Drive). This occurs through Android’s default auto-backup feature, which is enabled by default but configurable in device settings (e.g., Settings > System > Backup). The apps do not send any data over the internet by themselves, and backups are handled entirely by the Android system.

User Control: We believe in empowering our users to have full control over their settings. Users can easily modify or delete their preferences within the apps at any time.

.

.

2024.01.20 Saturday ACHK

眾害取最輕

眾害取其輕 | The least of all evils, 13 | 友情演義 2 | 相聚零刻 3 | 無拍之拖 3 | 原來是你 4

這段改編自 2023 年 6 月 20 日的對話。

.

第一,我們萬不可在,自己的生存並未受威脅時,為了換取現實利益,而犧牲道德原則。

第二,在我們的生活勉強可過時,萬不可因要得到較佳報酬,而犧牲他人。

第三,當我們因生活困難,而被迫不得不放棄,若干作人的原則時,我們必須儘可能作「道德的抗戰」,把道德的領土放棄的愈少愈好;而且要存心待機「收復道德的失地」。

— 人生的意義

— 殷海光

— 加了格式和標點

.

有時,你會被迫做,一些「必要之惡」。但是,那並不代表,你沒有任何責任,去盡快盡量減輕,那「必要之惡」。

例如,結婚前叫做「拍拖時期」。而拍拖前,則是「曖昧時期」。

那是一段模稄兩可,事後既可以標籤為「友情」,亦可能標籤成「愛情」的時期。如果成功發展成情侶的話,那就是愛情的開端時期;如果不成功的話,那就不屬於什麼特別時期,因為那段時空,只是日常一般,朋友間的交往。

維持「曖昧時期」,不是健康的關係,因為,如果一邊覺得只是友情,而另一邊卻覺得不是的話,即引起極大誤會,所以我視「曖昧時期」為「害」。

但那是「必要之惡」,因為人不會未卜先知;你總不能,亦總不會,在從來未相處暸解過,就喜歡別人,向她示愛。

— Me@2023-10-12 07:55:14 PM

.

.

2024.01.18 Thursday (c) All rights reserved by ACHK

7z to encrypt folder with AES 256

Sequential speed, 2 | Restore, 2

.

7za a -mmt4 -tzip -p -mem=AES256 /target_folder/the_zip_file.zip /source_folder/

a

Add files to archive

-mmt[N]

set number of CPU threads

-t{Type}

Set type of archive

-p{Password}

set Password

-m{Parameters}

set compression Method

.

How to check the encryption algorithm of a 7z/zip file?

7z l -slt /target_folder/file.zip

l

List contents of archive

-slt

show technical information for l (List) command

.
To unzip:

7za x /source_folder/the_zip_file.7z -o/target_folder/

x

eXtract files with full paths

-o{Directory}

set Output directory

— Me@2023-11-26 12:17:46 PM

.

.

2024.01.14 Sunday (c) All rights reserved by ACHK

3.6 Analytic continuation for gamma function, 4

A First Course in String Theory

.

Explain why the above right-hand side is well defined for \displaystyle{  \Re (z) > - N - 1  }.

~~

\displaystyle{  \begin{aligned}    \Gamma (z) &= \int_{0}^{1}t^{z-1}e^{-t}dt + \int_{1}^{\infty}t^{z-1}e^{-t}dt \\\\    \end{aligned} \\ }

.

Prove that \displaystyle{\int_{1}^{\infty}t^{z-1}e^{-t}dt} converges.

Prove that \displaystyle{\int_{0}^{1}t^{z-1}e^{-t}dt} converges.

Under this condition,

\displaystyle{ \begin{aligned} &\int_{0}^{1}t^{z-1}e^{-t}dt \end{aligned}  }
\displaystyle{   = \int_{0}^{1} t^{z-1} \left( \sum_{n=0}^N \frac{(-t)^n}{n!} +\sum_{n=N+1}^\infty \frac{(-t)^n}{n!} \right) dt, }
\displaystyle{   = \int_{0}^{1} t^{z-1} \sum_{n=0}^N \frac{(-t)^n}{n!} dt + \int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt}

\displaystyle{   = \sum_{n=0}^N  \frac{(-1)^n}{n!} \frac{1}{z+n} + \int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt}

So for \displaystyle{\Re (z) > 0},

\displaystyle{  \begin{aligned}  &\Gamma (z) \\  &= \int_{0}^{\infty}t^{z-1}e^{-t}dt \\  &= \int_{0}^{1}t^{z-1}e^{-t}dt + \int_{1}^{\infty}t^{z-1}e^{-t}dt \\  &= \sum_{n=0}^N  \frac{(-1)^n}{n!} \frac{1}{z+n}   + \int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt + \int_{1}^{\infty}t^{z-1}e^{-t}dt \\  \end{aligned} \\ }

If we define this as the analytic continuation of Gamma function:

\displaystyle{  \begin{aligned}  \Gamma_c (z)   \end{aligned} \\ }

\displaystyle{  \begin{aligned}  = \sum_{n=0}^N  \frac{(-1)^n}{n!} \frac{1}{z+n}   + \int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt + \int_{1}^{\infty}t^{z-1}e^{-t}dt \\  \end{aligned} \\ },

its convergence depends on the convergence of the middle term:

\displaystyle{  \begin{aligned}  \int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt \\  \end{aligned} \\ }

By the argument above, a necessary condition for this term to converge is

\displaystyle{  \Re (z) + n_{\text{min}} > 0  }

So

\displaystyle{  \Re (z) + N + 1 > 0  }

\displaystyle{  \Re (z) > - N - 1   }

However, besides the integral convergence, we have to consider also the summation convergence.

.

To check whether the order of integration and summation can be interchanged, we rewrite the term as

\displaystyle{  \begin{aligned}  &\int_{0}^{1} t^{z-1} \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt \\  &= \int_{0}^{1} t^{z-1} \left( e^{-t} - \sum_{n=0}^N \frac{(-t)^n}{n!} \right) dt \\  \end{aligned} \\ }

Since both \displaystyle{e^{-t}} and \displaystyle{\sum_{n=0}^N \frac{(-t)^n}{n!}} are finite, \displaystyle{  \begin{aligned}  \sum_{n=N+1}^\infty \frac{(-t)^n}{n!} dt   \end{aligned} \\ } is also finite.

— Me@2023-09-07 07:38:17 PM

.

.

2024.01.10 Wednesday (c) All rights reserved by ACHK

What is absolute is the change of shape

@dialectphilosophy, 1.3.4

.

The key point is that the observer within the car can see the separation changes among some objects, including the car itself, within the car.

Besides seeing the separation changes, the observer can also feel the acceleration directly within his body. The feeling of force is also due to the separation changes, but among points of his body.

How come a free falling frame is equivalent to an inertia frame? In other words, if acceleration is really absolute, how come a free falling observer cannot feel the acceleration?

Short answer: Acceleration is absolute in general, but not in all cases. What is absolute are the particles’ positions relative to each other in a physical system.

Long answer:

For two free falling objects, if they start to fall at the same time, they have equal initial velocities. Then, according to the equation

s = ut + \frac{1}{2}at^2,

the displacements of them are always the same. So their separation is always constant.

For the two objects, their displacements are

\begin{aligned}  s_1 &= u_1 t_1 + \frac{1}{2} a_1 t_1^2 \\  s_2 &= u_2 t_2 + \frac{1}{2} a_2 t_2^2 \\  \end{aligned}

If u_1 = u_2, t_1 = t_2, and a_1 = a_2, then s_1 = s_2. As a result, their separation remains unchanged.

Note that the separation would remain unchanged only if

1. the acceleration is uniform (in space) so that a_1 = a_2 always; and

2. both initial velocities have an identical value, i.e. u_1 = u_2.

So what really is absolute is not acceleration, but the separation changes among points seen by the observer within the physical system. Let us label “the separations among points” as “the spatial configuration”, or as an even simpler term: “the shape of the physical system”.

— Me@2023-12-06 11:06:23 AM

— Me@2023-12-24 05:58:54 PM

.

.

2024.01.10 Wednesday (c) All rights reserved by ACHK

上山尋寶, 3

It’s the time that you spent on your rose that makes your rose so important.

— The Little Prince

.

In economics and business decision-making, a sunk cost (also known as retrospective cost) is a cost that has already been incurred and cannot be recovered. Sunk costs are contrasted with prospective costs, which are future costs that may be avoided if action is taken. In other words, a sunk cost is a sum paid in the past that is no longer relevant to decisions about the future.

Even though economists argue that sunk costs are no longer relevant to future rational decision-making, people in everyday life often take previous expenditures in situations, such as repairing a car or house, into their future decisions regarding those properties.

— Wikipedia on Sunk cost

.

.

2024.01.06 Saturday ACHK

她有騙我嗎?

我們不會無緣無故地,憑空,知道世界。

我們只能透過(直接或間接的)觀察世界(,加上推理),去認識世界。

我們只能透過現象,去瞭解本體。

我們不會憑空知道「全部事實」,那是「全知」。

我們只能透過,收集事實的部分,去了解事實(的全部)。

— Me@2023-11-14 10:59:22 AM

.

.

2024.01.02 Tuesday (c) All rights reserved by ACHK