# 人生 Presentation, 2.3

.

.

.

.

.

.

— Me@2023-02-28 11:16:42 AM

.

.

# Euler problem 10.2

Find the sum of all the primes below two million.

```removeIf :: (a -> Bool) -> [a] -> [a]
removeIf p = filter (not . p)

sieveIter :: Integral a => [a] -> [a] -> [a]
sieveIter [] (x:xs) = x:xs
sieveIter (x:xs) acc
| x^2 > last (x:xs) = reverse acc++(x:xs)
| otherwise = sieveIter xss (x:acc)
where
xss = removeIf (\n -> n `mod` x == 0) xs

primeList :: Integral a => [a] -> [a]
primeList xs = sieveIter xs []

pL :: [Integer]
pL = primeList [2..2000000]

f :: Integer
f = sum (takeWhile (< 2000000) pL)
```

— colorized by palette fm

— Me@2023-02-25 12:35:57 PM

.

.

# Zsh, 2

To install the `Z shell` (`Zsh`):

1. Read my blog post “Zsh” to follow the instructions point 1 and point 2.

2. In the `Bash` terminal, run

```zsh
```

once, in order to get the config file generated.

— Me@2023-01-19 12:41:56 PM

— Me@2023-02-24 05:19:38 PM

.

.

# Looper, 6

Causal diamonds in time travel, 3

.

Time travel in the absolute sense is logically impossible.

If time travel was logically possible, it still could be logically consistent from the time traveller’s point of view, as long as he cannot see from the perspective of the meta time.

— Me@2016-06-01 07:10:51 AM

— Me@2023-02-23 12:13:20 PM

.

.

# When physics meets biology

oli5679 on May 15, 2018

There was a really good chapter on his time in a biology lab in his book, “Surely you’re joking Mr. Feynman”. I have always remembered this quote:

When it came time for me to give my talk on the subject, I started off by drawing an outline of the cat and began to name the various muscles.

The other students in the class interrupt me: “We know all that!”

“Oh,” I say, “you do? Then no wonder I can catch up with you so fast after you’ve had four years of biology.” They had wasted all their time memorizing stuff like that, when it could be looked up in fifteen minutes.

sykh on May 15, 2018

Feynman was wrong on his view. The same thing could have been said of him and physicists. Oh, you spent your time memorizing formulas when it could be looked up in 15 minutes.

This is a nonsensical point of view for two reasons. [1] People in areas of their expertise tend to know a lot in that area off the top of their head because they have encountered this stuff so much that it has become memorized. That memorized knowledge comes from experience not a memorization exercise. [2] It’s also nonsensical because if you didn’t have a core set of knowledge memorized in your area of expertise and instead relied on spending 15 minutes looking up each fact necessary to understand a given situation you’d end up wasting your whole day just trying to understand the meaning of the problem.

— Hacker News

.

.

2023.02.22 Wednesday ACHK

# Euler problem 10.1

Find the sum of all the primes below two million.

```(defmacro sq (x)
`(* ,x ,x))

(defmacro last-item (lst)
`(car (last ,lst)))

(defun good-reverse (lst)
(labels ((rev (lst acc)
(if (null lst)
acc
(rev
(cdr lst)
(cons (car lst) acc)))))
(rev lst nil)))

(defun prime-sieve-a-list (input-lst)
(labels ((sieve-iter (go-lst acc-list)
(if (not go-lst)
acc-list
(if (> (sq (car go-lst))
(last-item go-lst))

(append (good-reverse acc-list)
go-lst)

(sieve-iter
(remove-if #'(lambda (x)
(=
(mod x (car go-lst))
0))
(cdr go-lst))
(cons (car go-lst)
acc-list))))))

(sieve-iter input-lst '())))

(defun range (max &key (min 0) (step 1))
(loop :for n :from min :below max :by step
collect n))

(defmacro prime-sieve (n)
`(prime-sieve-a-list (cons 2 (range (1+ ,n)
:min 3
:step 2))))

(defun sum (lst)
(reduce #'+ lst))

(sum (prime-sieve 2000000))

(time (sum (prime-sieve 2000000)))
```

— Me@2023-02-16 11:34:49 PM

.

.

# G40-70

If you are using SSD, you should turn off the `swap` file:

1. In command line, run

```swapoff --all
```

2. Backup the file

```/etc/fstab
```

3. Then, in that file, comment out any lines that contain the word “swap”.

— Me@2023-02-14 05:00:26 PM

.

.

# Causal diamonds in time travel, 2

Time travel in the absolute sense is logically impossible.

If time travel was logically possible, no observer would see any paradox if there is no meta-observer, who can compare results seen by different observers.

— Me@2016-06-12 12:12:40 PM

— Me@2023-02-13 12:53:31 AM

.

.

# Computing Note, 4

```08[.]07[.]2002

1. Use Computer Software to improve/[]upgrade

10[.]07[.]2002

2. Software Philosophy:

Use it, enjoy it, but keep your ability
to live without it.

<<Conversation with God>>

Enjoy everything, but need nothing!

(Even people?
Especially people!)
```

.

.

# 大恩養仇人 3

.

「幫助別人」就有如「責備別人」，雖然有時必須，但是越小越好，越少越好。

「幫助別人」就有如「服用藥物」，雖然有時必須，但是越小越好，越少越好。

.

.

「醫藥治療」雖然有時必須，但是越小越好，越少越好。

.

.

.

「福利主義」的意思，就是把偶然的「福份」，視為必然的「權利」。那是錯的！

.

— Me@2022-11-05 12:54:58 PM

— Me@2023-02-09 12:24:10 PM

.

.