Live data from Hacker News

My favorite prime number generator

eli.thegreenplace.net

1–10 of 88 posts

Re: My favorite prime number generator

#2
My favorite prime number generator is

    ┬─┬───────────────────────────────────┬──── ────┬
    │ │ ┬─┬ ────┬─┬────────────────────── ┼───┬ ┬───┼
    │ │ └─┤ ────┼─┼───────────────────┬── ┼───┼ │ ┬ │
    │ │   │ ┬───┼─┼───────────────────┼── ┼─┬─┼ │ ┼ │
    │ │   │ │ ─ ┼─┼─┬─────┬──── ──────┼─┬ │ ├─┘ └─┤ │
    │ │   │ │ ┬ └─┤ │ ┬─┬ ┼─┬─┬ ──┬───┼─┼ ├─┘     ├─┘
    │ │   │ └─┤   └─┤ └─┤ │ ├─┘ ──┼─┬─┼─┼ │       │
    │ │   │   │     │   │ ├─┘   ┬─┼─┼─┼─┼ │       │
    │ │   │   │     │   ├─┘     └─┤ │ ├─┘ │       │
    │ │   │   │     └───┤         │ ├─┘   │       │
    │ │   │   │         │         ├─┘     │       │
    │ │   │   │         ├─────────┘       │       │
    │ │   │   ├─────────┘                 │       │
    │ │   └───┤                           │       │
    │ │       ├───────────────────────────┘       │
    │ ├───────┘                                   │
    └─┤                                           │
      └───────────────────────────────────────────┘
which graphically depicts the 167-bit lambda term

    λ 1 (1 ((λ 1 1) (λ λ λ 1 (λ λ 1) ((λ 4 4 1 ((λ 1 1) (λ 2 (1 1)))) (λ λ λ λ 1 3 (2 (6 4))))) (λ λ λ 4 (1 3)))) (λ λ 1 (λ λ 2) 2)
which generates the characteristic sequence of primes [1] [2].

[1] https://tromp.github.io/cl/cl.html

[2] https://github.com/tromp/AIT/blob/master/characteristic_sequ...

Re: My favorite prime number generator

#8
Can I just say how surprised I am the many people have a favourite prime number generator.

I can’t say I have a favourite but I do enjoy multiplying two random prime numbers with each other and using the random result when I need a random number with added random.

Re: My favorite prime number generator

#9
post #6

In J generating prime numbers is simply p:21, that gives you 79 which is the 21st prime number. It is so fast, I wonder what the algorithm behind it is. [0]: https://code.jsoftware.com/wiki/Vocabulary/pco

How high can you go with this?

I have J on my android phone, and the highest I could go was

p: 100999999, the prime numbers is 2059519669

Post reply on HN