text:
Sleep for 1000 years
Some sleep commands implement a delay of an integer number of seconds. However, 2³² seconds is only about 100 years. Bug! What if you need a larger delay?
Make a program or a function which waits for 1000 years, with an error of less than ±10%. Because it's too time-consuming to test, please explain how/why your solution works! (unless it's somehow obvious)
You don't need to worry about wasting CPU power - it can be a busy-loop. Assume that nothing special happens while your program waits - no hardware errors or power failures, and  the computer's clock magically continues running (even when it's on battery power).
What the solution should do after the sleep is finished:

If it's a function: return to caller
If it's a program: terminate (with or without error) or do something observable by user (e.g. display a message or play a sound)

“Around computers it is difficult
to find the correct unit of time to
measure progress.  Some cathedrals took a century to complete.  Can you imagine the grandeur and scope of a program that would take as long?”  —Epigrams in
Programming, ACM SIGPLAN Sept. 1982. (via fortune CLI app)

Because it's too time-consuming to test,: If your implementation is based on polling a real‑time clock (RTC), you may simply adjust the RTC to a date/time about 1 kiloyears in the future. In UNIX‑like environments like Linux or FreeBSD you can invoke the date command‑line utility to that end.
What if you need a larger delay?: Easy, employ time dilation.

MATL, 6 5 bytes
35WY.

This waits for 34359738368 seconds, which is a little more than 1089 years and a half.
Don't try it online!
Explanation
35     % Push 35
W      % 2 raised to that. Gives 34359738368
Y.     % Pause for that many seconds

I doubt anyone will find any way that beats this. Then again, I'm surprised to see it this short, so I could be surprised again. The only way I can think of is if another language can do basically the same thing but has a 1-character sleep function (as opposed to 2 ["Y."]).

C (gcc), 40 36 32 29 26 24 bytes
i;f(){--i&&f(sleep(7));}

Try it online!
-3 thanks to @gastropner.
-1 recursive approach thanks to @AZTECCO.
4294967295*7/86400/365.25 ~ 952.69

Can bump the sleep a hair more with a more accurate year: 365.242193…

Witchcraft! Dark Arts!!! Why is it possible to call a function as it is being declared, and more precisely, how can you give a parameter to a parameterless function???

@M.Herzkamp (1) because why wouldn't you be able to? (2) in C, a function defined with an empty parameter list (as opposed to a void parameter list) is treated as a varargs function.

would be more interested why you think this runs 2^32 times - and not 2^31 times - as an i variable would be predefined as going from -2^31 to (2^31)-1 (signed) and I dont see an unsigned definition

@eagle275 Because i goes from 0 to -1, then all the way to -(2^31), the next decrement takes i to (2^31)-1, then i goes all the way back to 0;

Is i somehow guaranteed to be initialized to 0? I still operate under the assumption that it should be treated as garbage if not initialized; then again, I frequently have to work with ancient legacy code that still uses old compilers.

@Aaron Globals in C are initialized to 0

Signed overflow is undefined, so the compiler is allowed to optimize the check out.

@ErburethsaysReinstateMonica Good thing there are no optimisation flags used  then. The default is optimization off: "generates unoptimized code".

This answer is more appropriate on stackoverflow ;)

I hope the compiler implements proper tail call elimination. Otherwise you will run into an out of memory error, unless your computer happens to have 45*8 TB heap memory. Ok, not that difficult if you are using virtual memory and swap it all out.

I voted for this answer when it wasn't so great. Too bad I cannot vote again!

Wrong, unfortunately: this relies on something that C cannot guarantee (and in fact, guarantees to be false in many old systems and probably all future (>32bit) ones...) : that the size of int is 32bits. Read carefully the (old but GREAT) C faq : it's answer 1.1 for exemple: http://c-faq.com/decl/inttypes.html states carefully that int "... can hold values up to 32,767" because the only thing C says is than "int" is AT LEAST 16 bit (not 32, and can be 36, 18, and any number of bits that can hold 16 bits inside). Thus you end up sleeping very different amount of times depending on the system.

so maybe edit to change i to int32_t i=0 (as not sure int32_t is set to 0 by default). Needs a c99 (or more recent) compiler, and a machine that can have int on 32 bits (this depends on the system, and the compiler will then barf out if your system doesn't support int32_t)

@OlivierDulac As long as it works for some compiler on some system, the answer is valid.

Python 3 (Excluding CPython on Windows), 28 bytes
import time
time.sleep(3e10)

Try it online! (Remember to put something in your will so future generations can check that it ended on time.)
time.sleep(seconds) takes either an int or a float.
1000*365.2422*24*60*60/3e10 == 1.051897536 which is an error of less than 10%.

This does not work in CPython on Windows. time.sleep of CPython only supports sleeping up to 2^32-1 ms = a little bit less than 50 days. (Limit imposed by WinAPI Sleep)

@JiminP Just goes to show you: If you want to run something for a millennium -  don't do it on Windows! T_T

bash, 26 24 bytes
I think part of the challenge here is to not have a signed 32 bit overflow, so:
ping -i86400 -c365243 t.co

The idea here is to make 1000 years of pings (365243), once per day (86400).
"t.co" is simply a four character internet hostname (in this case, a link shortener).  If your local host table has a one character hostname, you can subtract 3 bytes.
Edit: corvus-192 points out that country code ai resolves as a host, so you can write:
ping -i86400 -c365243 ai

As this will should work for anyone, I will accept this.  Saved 2 bytes.

You have more faith in the longevity of IPv4 than I do.

@Caleb: This only has to start today, on a system that will stay up for 1000 years, not continue to do IPv4 DNS lookups.  But yes, ping on my GNU/Linux system supports IPv6 addresses (without having to invoke it as ping6), and localhost is ::1 saving 1 byte.  ping :: also works, for the IPv6 unspecified address, saving 2 bytes but getting error messages (ping: sendmsg: Network is unreachable).

Do you need to ping a working domain? Wouldn't this still work according to spec if all the pings failed by calling a fake domain like t?

With my version of ping, ping 1 attempts to ping 0.0.0.1, which saves 3 characters if you can get that IP to ping.

@Vortico It does not on my ubuntu 16.04 system and ping does not work on TIO so i wouldn't say this is valid.

I don't like the IPv6 addresses as it requires a particularly recent Linux and IPv6 enabled.  It wont work to simply ping t because the address must resolve, though it is not the case that there must be a host there.  ping 1 should not work, and does not for me.  I also don't want to assume a shorter alias in /etc/hosts, as not everyone would have that, but as noted, it can shorten the golf.  As for the longevity of IPv4: it has already survived decades past it's replacement.  :-)

For me, ai resolves to 209.59.119.34, which is 2 bytes shorter.

Ruby, 10 bytes
sleep 3e10

Try it online!
There are approximately \$3*10^{10}\$ seconds in a thousand years.

sleep 32e9 is more accurate and has the same size in bytes

31557600000 seconds

"Try it online!". LOL

6502 Machine Code on an Apple II, 10 9 bytes
Code is actually platform-independent, other than it relies on the Apple's clock speed of 1.023 MHz for timing.
Code starts at address 0x0000:
0000: A2 CA F6 44 F0 FB D0 F8 F7
Saved an additional byte. Details are below original answer.
Original answer:
Code starts at address 0x0059:
0059: A2 08 F6 60 D0 FA CA D0 F9 F5
Disassembly:
loop1: 0059- A2 nn     LDX #$nn   ; 2 cyc
loop2: 005B- F6 60     INC $60,X  ; 6 cyc
       005D- D0 FA     BNE loop1  ; 2-3 cyc
       005F- CA        DEX        ; 2 cyc
       0060- D0 F9     BNE loop2  ; 2-3 cyc
       0062- pp        DB  $pp    ; data byte

This is a fairly simple routine that increments a multi-byte counter. When the counter rolls over, the last branch instruction gets modified so that it points to an RTS instruction, which provides the exit for the routine.
loop1 is taken for each increment of the counter and takes 11 cycles per iteration. loop2 is taken for each byte carried over and takes 13 cycles per iteration. So if we increment the counter N times, we spend approximately:
11*N + 13*(1/256 + 1/(256^2) + 1/(256^3) + ...)*N
= 11.05*N cycles
1000 years is 365242*86400*1023000 = 32282717702400000 cycles
So we need N = 2921512914244345 +/- 10%
Or a range of 2629361622819911 - 3213664205668779
  = 0x095763F583A447 - 0x0B6ACF816801AB
In the code above, set pp = 0xF5 and nn = 0x08.
This gives us a 7-byte counter in memory locations 0x62-0x68
(with MSB at lowest address, i.e. big endian). Only location 0x62
is initialized, so our starting counter value could be anywhere
from 0xF5000000000000 to 0xF5FFFFFFFFFFFF.
We'll increment the counter until it rolls over to 0, which
will cause the byte at 0x61 to increment by 1, which happens
to be the branch target for loop2. On the first byte carry
after rollover-- when the counter hits 0x100-- we'll hit the
modified branch instruction for the first time. This will take
us to address 0x5C (loop2+1). The 0x60 byte there is the opcode
for "Return from Subroutine" (RTS) which provides our exit.
So our total loop count is between, 0x0A000000000101 and
0x0B000000000100, which is a subset of the range we calculated
which gives us the necessary number of cycles +/- 10%.
Now that we have the exact starting and ending counter values,
we could go back and calculate the exact cycle counts, but given
how much margin there is, I'm willing to hand-wave that part.
You can actually test it out with smaller values of nn. For example nn of 4 will pause for several seconds.
9-byte answer:
0000- A2 CA     LDX #$CA   ; 2 cyc
0002- F6 44     INC $44,X  ; 6 cyc
0004- F0 FB     BEQ $0001  ; 2-3 cyc (rollover)
0006- D0 F8     BNE $0000  ; 2-3 cyc (non-rollover)
0008- F7        DB  $F7    ; data byte

Saved one byte by folding the DEX opcode into the
argument for LDX.
Instead of 11.05 cycles, each counter increment is now
13 + 11*(1/256 + 1/(256^2) + ...) = 13.043 cycles.
Now we need 2475073064976549 +/- 10% iterations,
or a range of 0x7E9F591BF7A2E - 0x9AC2C23EA071C.
So now we initialize the 7-byte counter to something
between 0xF7000000000000 and 0xF7FFFFFFFFFFFF. This ends
up giving between 0x08000000000001 and 0x09000000000000
loop iterations, which is within the +/-10% needed.
When the counter rolls over to 0, the last branch
gets modified to jump to $0001, which leads to an increment
of the BNE opcode itself (to a CMP instruction, which
for our purpose is effectively a no-op). Code then falls
through to $0008, which now contains a 0 (because of counter
rollover). A 0 byte is a BRK instruction, which drops you
back to the system monitor, ending the routine.

PowerShell, 35 32 24 21 19 bytes
1..3e4|%{sleep 1mb}

Try it online!
Strangely, the maximum seconds value for Start-Sleep is 2147483. No, I don't know why it's such an odd value. That works out to a little over 2 megabytes (2097152). 1mb * 30000 / 86400 / 365.25 is 996.821051030497, so a little under 1000 years. I could get more exact using a different value than 3e4, but this is within the allowed margin and I'm lazy.
Saved 3 bytes thanks to ceilingcat.
Saved 8 bytes thanks to Jeff Zeitlin.
Saved 3 bytes thanks to Neil.
Saved 2 bytes thanks to Mark Henderson and Nahuel Fouilleul.

Well, 2147483 is 1/1000th of a max 32-bit integer, so perhaps Powershell internally does some unit conversions with milliseconds or something. See here (MaxIdleTimeoutSec)

Save 8 bytes with 1..15000|%{sleep 2.04mb}.

@JeffZeitlin Good grief, I'm missing the obvious golfs today. Thanks!

Why not sleep 2mb? You'll get a little under 1000 years, but other than that it should be fine, I'd have thought?

Save yourself an extra byte with 1..15e3

or 1..3e4 and sleep 1mb

05AB1E, 6 bytes
27;°.W

Inspired by the other answer in 05AB1E.
Waits for 1027/2 milliseconds, or about 1002 years.
Explanation:
27            push the number 27
  ;           divide by 2
   °          replace X by 10 to the power of X
    .W        wait that number of milliseconds

Try it online!

Can you explain this a bit more? How does that translate to 10^(27/2)?

Nice approach! I actually just found another 6-byter myself as well. :)

Jelly, 8 bytes
32œS$ȷ9¡

Try it online!
A niladic link which waits for 32 seconds 1 billion times. 32,000,000,000 is within 10% of 31,557,600,000 seconds which is 1,000 years (ignoring leap seconds and ignoring the fact that centuries indivisible by 400 are not leap years).

Charcoal, 7 bytes
Ｆ³³ＲＸφ⁴

Try it online! Link is to verbose version of code with a speed up factor of 1e9 (obtained by changing the ⁴ into a a ¹) so that it doesn't time on TIO. Explanation:
Ｆ³³

Repeat 33 times.
ＲＸφ⁴

Refresh the screen, but delay 1000⁴ milliseconds between refreshes.
Although there are 33 refreshes, there are only 32 intervals, so the total delay is 32000000000000 milliseconds or approximately 1015 years.

I love the implications of “Try it online!” It was the year 12019, and the ancient computer finally woke up. Amazed, the engineers used the methods of long-dead programmers to find what was running. The computer said, Charcoal. The gods had spoken, and in that moment, programming became an important force in the world once again.

@BalinKingOfMoria 1000 years after now is 3019, not 12019 ;)

@OmegaKrypton The code sleeps for almost 1015 years anyway, so it would wake up some time during 3034.

@OmegaKrypton Oooops, I misremembered it as 10,000 years facepalm

I can't stand cryptic or archaic languages and would prefer everyone forget about them and use ones that are more readable (maybe Charcoal is and this is just an (ab)use of it?), but this still gets +1 for the effort even though it makes me cringe.

can this really be expressed in 7 bytes? Those are 7 characters but in UTF-8 they would be more bytes

@Agos Charcoal has its own code page (see the wiki in the linked github) although it will accept UTF-8 as well (there's a command-line flag for it).

clever! then the above translates to these 7 bytes: 0x46 B3 B3 B3 52 58 E6 B4

@Agos Nearly; they're actually 0xC6 B3 B3 B3 D2 D8 E6 B4.

Java (JDK), 23 bytes
v->Thread.sleep(7L<<42)

Try it online!
It's hard to find a short way to write a number in Java. Thread.sleep only accepts a long number of milliseconds. So the standard answer 3e10 doesn't work because it's a double. Casting it to a long would be the appropriate action. But it would still be 1000 too small. So enter 3e13 which is closer. But fortunately, 7L<<42 is 30,786,325,577,728, which is close to the actual count of 1000 years, and is a long without cast, so 4 bytes shorter than (long)3e13.
Credits

-4 bytes thanks to Neil by replacing (long)3e13 with 7L<<42.

@XtremeBaumer No: 3*10^13 = 19. Surely we want to sleep for more than 19 milliseconds. The ^ operator is the binary xor. There is no power operator in Java. Only Math.pow which also returns a double and therefore requires a cast, increasing the total byte count, not decreasing it.

Does this count here without alle the main class and the try catch for the interruption exception?

@avalancha Consensus is that lambdas are fine. You don't need to try/catch in lambdas since it relies on declaring interfaces that do all that for you. That's why I declared the Sleeper interface in my TIO. We're using several distinct rulings to get this far in golfing in Java.

awesome, thx for the link!

Can you use 7L<<42? It's about 3e13, I think.

How come you don't need the semicolon at the end?

@DmitryKamenetsky It's a lambda.

Also works in scala (with =>  instead of ->).

Batch, 41 25 bytes

-8 bytes thanks to AdmBorkBork
-6 bytes thanks to ceilingcat
-2 bytes thanks to inspiration from Neil

ping 1 -n 31556952000>nul

Using 31,556,952 seconds / year and a (default) 1 second delay between each ping, this will wait 1000 years before returning nothing.
Note that ping 1 results in failure but it'll fail 31 billion times so that still works.

How about 1.1.1.1 to save two bytes? Sure, it's not a valid "test" address (sorry, Cloudflare), but hey, it's code-golf. ;-)

Actually, more than that, because you can therefore do -n 31556952000000>nul and skip the -w, since there's a one second delay between each ping.

Why not 1.0.0.1, which abbreviates to 1.1?

APL (Dyalog Unicode), 9 8 bytesSBCS
-1 thanks to Eric Towers.
Full program. This works by observing that $$\sum_{n=1}^{8^6}n=3.44×10^{10}\approx3.16×10^{10}$$which is the number of seconds in a thousand years.
⎕dl¨⍳8*6

Don't try it online!
8*6 \$8^6=262144\$
⍳ ɩntegers until that
⎕dl¨ delay each of those many seconds

I don't know APL, but is ⎕dl¨3e10 good for 8 bytes?

@79037662 ¨ is "each" which wouldn't be needed in this case, but no, 3e10 is for some reason too big an argument for ⎕dl which appears to have a limit of 2147483 seconds.

8*6 = 262144, giving 1088.8... years.

@EricTowers Incorporated. Thanks!

Wolfram Language (Mathematica), 11 bytes
Pause[2^35]

2 to the 35th power is about 8.9% greater than 31,556,926,000.

I’m not at my computer right now to check, but can you save a byte with Pause@2^35 ?

Tried that—it pauses for 2 seconds and returns Null^35 :D

T-SQL, 56 bytes
DECLARE @ INT=0a:WAITFOR TIME'9:0'SET @+=1IF @<4E5GOTO a

The SQL WAITFOR command is limited to 24 hours, so it has to go in a loop.
WAITFOR has two options: DELAY that waits a certain length of time, or TIME which waits until a certain time of day. Turns out WAITFOR TIME'9:0' (which will pause until 9am the following day) is a couple of bytes shorter than WAITFOR DELAY'24:0'.
Using a GOTO loop is shorter than a WHILE loop.
I'm looping 4E5 times (400,000), which is within 10% of the 10-year (365,242 day) goal.
If I start it today, this would complete in February, 3115

R, 24 bytes
sapply(1:25e4,Sys.sleep)

Try it online!
A solid starter, feels like there's optimisation to be had with a different function & number combo. This sleeps for 1s, then 2s, then 3s, then 4s... up to 250000s, at which point it's been running for about 990 years and outputs a list of 250k empty elements.

why not 3e10 like the other answers

@qwr Sys.sleep(3e10) doesn't work, and I couldn't figure out a shorter way to write some version of for(i in 1:3e10)Sys.sleep(1) that works. If there is one then more fool me!

@qwr it occurred that there's a less obvious reason for this being the shortest one I found: 25e4 is the same length as 3e10, but sapply allows us to pass the counter into the function without parentheses making it valuable to find a number with sums along to roughly 3e10. The 1:25e4 is doing double duty here.

why doesn't Sys.sleep(3e10) work?

I'm not 100% on the why of it, but the documentation says on Windows Sys.sleep uses Sleep. I'm not knowledgeable of the specifics there, but the outcome is that it sleeps for a few milliseconds rather than a thousand years. Might behave differently on Linux?

Lua, 38 bytes
t=os.time;o=t()+2^35while t()<o do end

Try it online!
Being ANSI C compliant, Lua does not implement any sleep functions, so we have to make one ourselves. Oh, and make sure to keep the dust off that One Thousand Year Computer, we're busy waiting.
Lua, 38 bytes
t=os.time;o=t()+2^35repeat until o<t()

Try it online!
Same thing, different loop. Tried to see if I can save some bytes, but nope.

What the dingle bells, why does 35while not throw the parser into conniptions? Today I learned something about Lua I didn't want to know.

@Caleb In upcoming Lua 5.4, this will no longer works. They have learnt this lesson. Also, tio.run really should provide different Lua versions due to significant changes (this one will cause a lot of 5.3 golf break if they'll just update).

gbz80 machine code program, 40 (6 + 34) bytes
VBlank handler (put at 0x40)
CD 5A 01 F1 FB 76

Program after entrypoint (put at 0x150)
01 B7 02 21 FF FF 36 01 FB 76 2D 20 14 25 20 11
1D 20 0E 15 20 0B 0D 20 08 05 20 05 2F E0 21 E0
23 C9

Runs a timer that decrements every frame. At the Game Boy's frame rate, one thousand years is ~1,884,804,967,414 (0x1B6D7216BF6) frames (with a frame rate of 59.727500569606 fps and the assumption of 24 hours per day and 365.24 days per year). This program's timer runs for 0x1B6****FEFE frames. The stars are that the middle registers aren't initialized, and the bottom registers are used for an optimization, but the three most significant hex figures are correct and therefore the timer will be well within tolerance.
After the thousand years, the noise channel plays for a short while, and there will be a looping timer that will play the sound every ~149,339 years. Those are some good AAs.
Maybe it could be shorter if you want to cycle count instead of VBlank count.
Source:
section "VBlankInterrupt", ROM0[$40]
    call VBlankHandled
    pop af                  ; get rid of pushed return address
    ei                      ; enable interrupts
    db $76                  ; directly encoded halt, one byte saved over "halt"
                            ; ei and halt interact buggily, but it doesn't matter here because we discard the return address.

section "Header", ROM0[$100]
    jr AfterEntryPoint      ; thing for every Game Boy program, shouldn't count

    ds $150 - @, 0          ; Make room for the header

AfterEntryPoint:
    ld bc, $02B7            ; we have to set b one higher, because we decrement then check for zero. also did c because no reason not to and more accuracy
                            ; d and e will be set to their startup values.
    ld hl, $FFFF            ; double-use: part of timer and as a pointer
    ld [hl], $01            ; enable v-blank interrupt only
    ei
    db $76                  ; necessary halt to prevent stack underflow from return, again the return address is discarded so ei halt bug isn't a worry
VBlankHandled:
    dec l
    jr nz, .backToSleep
    dec h
    jr nz, .backToSleep
    dec e
    jr nz, .backToSleep
    dec d
    jr nz, .backToSleep
    dec c
    jr nz, .backToSleep
    dec b
    jr nz, .backToSleep
.madeItOut:
    cpl                     ; invert a, which is 01 from the pop
    ldh [$21], a
    ldh [$23], a            ; this and previous turn on and up the noise channel, which briefly plays because of time limit not being turned off
.backToSleep:
    ret

"Noise channel" and unpredictable waiting time are great additional details! Thank you!

C# (Visual C# Interactive Compiler), 59 bytes
b=>{for(var d=DateTime.Now.AddYears(999);d>DateTime.Now;);}

Can be tested by replacing AddYears() with AddSeconds()
Try it online!

Couldn't this be shortened by eliminating 'd' and making the 'for' a 'while'?

@bta you mean while (DateTime.Now.AddYears(999) > DateTime.Now); ? but that would result in an endless loop, as if I don't initially store DateTime.Now in a variable it will keep updating it`s value.

54 - you don't need to wrap the code in a function.

Mumps (M): 7 Bytes
H 9**11

Mumps likes single-letter commands & big numbers... H(ang) sleeps for ## of seconds; 9 to the 11th power gives 31381059609 seconds, which is almost 0.6% low for 1000 years; well within the margin of error.
Keeping with the 7 byte code length, I tested "power of 9" sleep times on 2 different Mumps implementations; the largest power of 9 on YottaDB/GT.M I can find without numeric overflow would be:
H 9**49

which gives a sleep time of just over 1,814 decillion millennia.  InterSystems' Cache doesn't overflow and can go to:
H 9**99

which gives 9.352x1083 millennia. That's quite a nap in 7 bytes!

Pyth, 10 bytes
VT.dC"¼€

Try it online!
There are exactly 31,557,600 seconds in the Julian astronomical year., totalling 31,557,600,000 seconds in 1000 years. 2^32 is about a tenth of this, so we just wait for 3,155,760,000 seconds ten times.
Note that € is a blank codepoint in the TIO, not sure why it translates to this on SE
Here you can see that C"¼€ is equal to 3,155,760,000
And here is an example that waits for only 22 seconds using a similar method
Pyth, 8 bytes
.dC"XúÃ

Try it online!
Alternatively, this one just uses C"XúÃ for 31,557,600,000. I thought it was more in line with the spirit of the challenge to have a 2^32 limit, though

The average length of a sidereal year, however, is 365.256363004 days or around 31,558,149.763 seconds, giving us a total of ~31,558,149,764 seconds in 1000 years. In this case, the more accurate solution would be
This: VT.dC"¼ê@
This:.dC"Y&ƒ(1 byte longer than Julian solution)

Perl 5, 18 bytes
sleep 1e9for 1..30

Try it online!
10 bytes (doesn't work)
sleep 3e10

Try it online!

Polyglot with Perl 6/Raku

actually it doesn't work : sleep() with negative argument

PHP, 30 bytes
The time() function can be used instead of microtime(1), as when plused with 3e10, PHP converts the value into a float, even when the original value is an int and thereby save some more bytes.
time_sleep_until(time()+3e10);

See how php converts values

As stated by "manassehkatz-Reinstate Monica" a flag can be set to make it run without the tags in PHP, so a more clean version is here made. (36 bytes)
time_sleep_until(microtime(1)+3e10);

Google tells me that 1000 years = 3.1556926 × 1010 seconds (31,556,926,000)
The method cloud even be made recoverable in the event of power failures. (not done in this example)
<?php time_sleep_until(microtime(true)+31556926000)); ?>

The shorter but more imprecise version (45 bytes with the php tags)
<?php time_sleep_until(microtime(1)+3e10); ?>

With a correction from "Kaddath" this option below is dropped as the documentation state that it is a int not a float used in sleep()
It can be done like so:

<?php sleep(31556926000); ?>

Try it online!

I love how you've added a "Try it online!" link :')

I think it would work with 1+"3e10" which saves 3 bytes ;) (automatic conversion to float and actually 31556926000 is already a float, not an int)

Well after having tested, my previous comment's suggestion doesn't work, but that means yours will not either: sleep converts argument to an int, so the value used will be 1492154928 when you use 31556926000, which is "only" 47.3 years (hard to verify, I know, must trust the documentation on this).. Sorry!

However, the second code with time_sleep_until will work, because it uses a float, and there you actually can use microtime(true)+"3e10".. EDIT: even better: microtime(1)+"3e10"

I updated my response based on your feedback Kaddath, but we do not need "" around 3e10, so we can save 2 bytes more :)

Congrats Mikki! Thanks for representing PHPers!
PS: do you really need the closing tag ?>? ;D

You can remove ?> And I know there is a flag to make it run without <?php that  is routinely used in Code Golf.

Victor F and manassehkatz-Reinstate Monica you are right, i think i will switch my score and make a note :)
As you might have spotted im new to Code Golf, so thanks for the tips :)

Just as a note, here’s the related meta post, explaining why and in which cases the opening tag can be discarded: https://codegolf.meta.stackexchange.com/q/7098/41859

JavaScript (Node.js), 70, 67, 34 bytes
-3 thanks to Joost K, see their answer for why I used 8e6
-33 thanks to Benjamin Gruenbaum for pointing out callbacks are better, using the concept of his answer
I've found 2 ways of solving this problem.
The first defines a globally:
(f=_=>a&&setTimeout(f,--a))(a=8e6)

the other method passes a through each time, using setTimeout's further args:
(f=a=>a&&setTimeout(f,--a,a))(8e6)

These solutions remain the same length when using IIFEs or just calling the function manually.

You can remove the space to save another byte :)

you can cut down 3 bytes by changing the loop like t=77e5;--t; and using t as the time to wait.setTimeout(r,t) See my C# answer where I use this in C#

@JoostK Clever, I'll add that in now, thanks :)

Same concept but with callbacks instead of promises :]
(function f(a){setTimeout(f,--a)})(8e6); at 40 characters

@BenjaminGruenbaum Wouldn't this carry on forever? and isn't a undefined?

@Kobe no - We are defining and immediately executing a function and passing 8e6 as a parameter.

I mean it will recurse forever, since there is not condition stopping the setTimeout from calling f again. And a will not be passed through on any of the iterations, you'd have to use _=>f(a) right? @BenjaminGruenbaum

Oh yeah you're right it's missing the a&& part

C# (Visual C# Interactive Compiler), 38 37 bytes
this waits 1 + 2 + 3.. +77e5-1 + 77e5ms.
I got this 77e5 magic number using the formula (x+1)/2*x=3e13 where x results in approximately 7.745.967 which I shortened to 77e5.
To check if it still falls in the allowed range I did 1000*365.25*24*3600*1000/((77e5+1)/2*77e5) which is 1.064 aka 6.45% of target
update : 8e6 results in 0.98 more precise and less bytes.
for(var i=0;i++<8e6;)Thread.Sleep(i);

Try it online!

05AB1E, 5 bytes
₆9e.W

Sleeps for about 1082 years.
Try it online!
₆         # push 36
 9        # push 9
  e       # nPr (number of 9-element permutations of a 36-element list)
   .W     # wait that many milliseconds

TI-BASIC, 17 bytes
For(I,0,2^32:rand(564:End

TI-BASIC doesn't have any wait commands/functions, so I just used one of the slowest functions available:  generating random lists!
Generating a random list of 564 elements takes \$\approx7.95\$ seconds to make and the loop goes through \$2^{32}\$ iterations, so that results in \$7.95*2^{32}=34144990003.2\$ seconds or \$1082.01255\$ years.

Matlab, 12 bytes
pause(3e+10)

This will sleep for 951 years which is within 10% of 1000 years. Note that Matlab can sleep for a floating number of seconds.
This is my first ever answer on CodeGolf :)

x86-64 function, 10 bytes
6A 16 59 48 C1 E1 1F E0 FE C3

In assembly:
sleep_for_a_thousand_years:
    push 0x17
    pop rcx
    shl rcx,52
    loopnz $
    ret

This is a function
The loopnz opcode decrements the rcx register and jumps if the zero flag is not set and rcx!=0 after it is decremented. $ denotes the address of the loopnz address itself, so this just loops back to the same instruction over and over until rcx is zero.
loopnz is infamously slow, and the code before sets rcx to 103,582,791,429,521,408. So this will loop 103,582,791,429,521,408 times, which should take 1012 years, based on some benchmarks I did on TIO. (The number may need to be tweaked a bit if you have some overclocked monstrosity though.)
Try it online! ... Actually, maybe skip that just this once.

Applescript, 10
delay 3e10

Sleeps for 3 * 1010 seconds.

05AB1E, 7 6 bytes
35oF.Z

~8.879% too large
Also take a look at this excellent alternative 6-byter by @anatolyg.
Previous 7-byters:
žqþ¨¨.W     # ~0.449% too small
žG14∍.W     # ~3.837% too large
13°3*.W     # ~4.936% too small

For 100%† precision (†: assuming a year is 365.25 days), use •Tε‚šä¦•.W (10 bytes) instead.
Explanations:
35          # Push 35
  o         # Pop and push 2 to the power 35: 34359738368
   F        # Loop that many times:
    .Z      #  And sleep for 1 second every iteration

žq          # Push PI with 15 decimal digits by default: 3.141592653589793
  þ         # Remove the dot by only leaving the digits: 3141592653589793
   ¨¨       # Remove the last two digits: 31415926535897
     .W     # Sleep that many ms

žG          # Push builtin integer 32768
  14∍       # Extend it to size 14: 32768327683276
     .W     # Sleep that many ms

13°         # Push 10 to the power 13: 10000000000000
   3*       # Multiply it by 3: 30000000000000
     .W     # Sleep that many ms

•Tε‚šä¦•    # Push compressed integer 31557600000000
        .W  # Sleep that many ms

See this 05AB1E tip of mine (section How to compress large integers?) to understand why •Tε‚šä¦• is 31557600000000.
05AB1E is built in Elixir, and its sleep builtin can even hold :infinity apparently, so I can assume the .W has no maximum.

5 bytes: ₆9e.W (waits ~8% too long).

@Grimmy Nice, I knew 5 bytes should be possible somehow with some of the 1-byte constants and 1-byte builtins! I was playing around with palindromize, factorize, euler_constant, etc. but forgot about e. Feel free to post it as your own answer in this case, since there are already two 05AB1E answers and my answer is already a bit too full (don't really want to remove the 7 byters). I'll upvote you when you do.

SmileBASIC, 19 bytes
@L
WAIT 12e7GOSUB@L

Waits 120 000 000 frames (around 21.2 days), and loops until the GOSUB stack overflows (after 16383 iterations)
This lasts 1038.32 years

Implicit outer loop - this is a great idea!

JavaScript (browser), 19 bytes
setTimeout("a",3e13)

This will throw and error in about a 1000 years.

SAS, 38 bytes
data;do i=1to 3e10;a=sleep(1);end;run;

This loop seems to be the shortest option as both sleep and wakeup are capped at 46 days - slightly less than 222 seconds. I wonder what the rationale for that was?

JavaScript (Node.js), 34 bytes
uses the 3e13 like most answers but in a for loop.
The 1 at the end is to make it a valid for loop.
d=Date.now;for(i=d();i>d()-3e13;)1

Try it online!
Don't actually try it...

Roblox, 11 bytes
wait(3e+10)

Waits 30,000,000,000 seconds, which is roughly equal to 950 years.

MSX-BASIC, 47 characters
1FORK=1TO31557600000:TIME=0
2IFTIME<50GOTO2
3NEXT

TIME is a MSX-BASIC system variable holding a 50Hz counter that can be initialized to any value at will. There are 31557600000 seconds in 1000 years (assuming one leap year every 4 years) so there you go.

Zsh/Bash/Sh, 23,19,14,10 bytes
sleep 8e6h

-4 bytes thanks to @Grimmy
Explanation
GNU coreutils sleep command can take a suffix of either s (seconds), m (minutes), h (hours), or d (days). It also accepts IEEE-754 numbers, which allows us to use the shorter form of 8e6 to specify 8M hours.
8 million hours is equivalent to roughly 912½ years.

sleep 3e10, sleep 8e6h, sleep 5e8m are all 10 bytes and within the 10% tolerance.

@Grimmy Thank you!

RPL, 8 bytes
3E10WAIT

shall wait 3e10 seconds on, say, your hp48sx. Good the OP excluded hardware issues, so we can ignore the reboot at the end of Dec. 31st, 2088 (the date is reinitialized to Jan. 1st, 1989.)
For RPL/2, add one byte as a space is needed before WAIT.
I am surprised such commands are accepted anyhow…
Btw a challenge about 2763 years would allow us to use the factorial as in 14!WAIT.

MathGolf, 15 bytes
{tï╜Ä_⌐_¬Wó+<}▲

Just like my top 05AB1E answer, it's ~8.879% too large.
Try it online with debugging argument -d to see what's going on.
Explanation:
There were a few difficulties to tackle here:

Apparently there is no way in MathGolf to access a value outside of the scope of a while-loop. I therefore had to push the initial timestamp inside the loop, and by using some duplicates and stack-rotates access it to check against the current timestamp.
After that I initially had {t_⌐_¬Wó+<}▲ (12 bytes) to overcome the issue mentioned at point 1. Unfortunately there are some bugs in MathGolf, so this required a leading 1, otherwise the do-while didn't work: 1{t_⌐_¬Wó+<}▲.
MathGold is built in Python, and since Python's List size is limited to 536,870,912 items, I therefore had to remove unused garbage from the stack instead of letting it grow by one additional item every iteration. (Since it executes roughly 5-10 iterations per ms on TIO, the stack size grows way too fast to last even close to 1000 years.) I did this by adding an if-statement in front of that initial duplicate, so I only duplicate it in the very first iteration. For some reason I could now also remove that 1 which was used as a bug-workaround..

Putting it all together gave me the 15-byter you see here, with the following code explanation:
{            }▲  # Do-while true with pop:
 t               #  Push the current timestamp
  ï              #  Push the current 0-based loop-index
   ╜             #  If it's falsey (so it's the first iteration):
    Ä            #   Execute the following single command:
     _           #    Duplicate this initial timestamp
      ⌐          #  Rotate the stack, so the bottom item is at the top
       _         #  Duplicate it
        ¬        #  And rotate the stack back, so its both at the top and bottom now
         Wó      #  Push 35, and then pop and push 2**35: 34359738368
           +     #  Add it to the timestamp of the first iteration
            <    #  And check whether it's still lower than the current timestamp

CJam, 15 14 bytes
-1 byte because I forgot that e[numeric literal] existed.
es3e13+{_es>}g

Please don't try it online, it won't work!
This waits in a while loop until the current Unix timestamp is equal to the timestamp at the beginning of execution plus 3*10^13 milliseconds (or ~951.3 years).

Rust, 55 bytes
||std::thread::sleep(std::time::Duration::new(2<<34,0))

Try it online! (or not, it will take ~1089 years to do anything interesting)
Rust's thread::sleep takes a Duration as an input, and those conveniently store the count of seconds as a u64.

VBA, 27 bytes
This program adds an approximation of 1000 years, in days, to the current time, and instructs the program to wait until that time is encountered.
Application.Wait 365242+Now

For for a more accurate result, the below may be used at a cost of 41 bytes.
Application.Wait DateAdd("yyyy",1000,Now)

Python 3, 46 48 bytes
import time
for _ in range(7889):time.sleep(4e6)

Try it online!
Based on this answer. Used for loop to circumvent the overflow in time.sleep(). 3e10 shows overflow but 3e9 doesn't. No Overflow errors are show on the online interpreters(TIO and ATO) but on attempting on personal computer it does show error. The suggestion by @anatolyg has been implemented, which is working on both interpreters.
Previous erroneous answer
import time
for _ in range(10):time.sleep(3e9)

On my Windows machine, sleep(3e9) overflows. Maximal number of seconds for which sleep succeeds is 4294967 (2**32/1000). Here, the following code would work: for _ in range(7889):time.sleep(4e6). On which platform does sleep(3e9)  succeed?

@anatolyg sleep(3e9) works for me on TIO and ATO(online code execution). I have now checked my code on my computer and it does show Overflow error for 3e9. Perhaps the online interpreters are using some kind of optimization. Either way, I will change my answer to reflect your point.

J, 11 bytes
    6!:3\i.2^18

Explanation:

6!:3:  'delay' function
\: Loop over the entire following value
i.2^18: A list of values from 0 to (2^18)-1

Thanks to @CriminallyVulgar for the 2^18 idea!
Try it online... or maybe don't

Welcome to Code Golf, and nice answer!

Fortran (GFortran), 42 bytes
integer(kind=8)i;i=56**6
call sleep(i)
end

Try it online!
Gnu Fortran's sleep routine only works with an integer number of seconds. Problem is, the default integer type in GFortran only goes up to 2147483647 which only gets us to less than 100 years, and (according to the units utility) we need approx 3.1556926e+10 seconds to get us to 1000 years. But we can tweak i to a larger type, using kind=8, which works fine with sleep.
Setting i=56**6 gets us to 30840979456 seconds, which is more interesting (and closer to 1000 years) than i=3e10. I found this number by messing around with cube roots and higher with gnu bc -l. Example: e(l(3e10)/3) in bc gets the cube root, e(l(3e10)/6) gets the 6th root!
I suppose I could have just looped the program a few times instead of faffing about with integer types but where's the fun in that?

Minecraft Command, 45 bytes
/summon wind_charge ~5 ~ ~ {Motion:[-7e-12d]}

Summons a wind charge 5 blocks away from the player, with a motion towards the player of 7×10⁻¹² blocks per gametick. The wind charge moves slowly towards the player until it's less than 0.6 blocks away, where it touches the player's hitbox and explodes.
This takes (5 - 0.6) / 7e-12 = 628571428571 gameticks or 31428571429 seconds, which is 0.4% less than 1000 years (assuming each year is 365.2425 days long).
This is what it looks like sped up by a factor of 10¹⁰.

Red, 9 bytes
wait 3e10

Try it online!

Tcl, 23 bytes
after 30000000000000000

Try it online!

at, 19 bytes
at now + 1000 years

@JoKing I think it's linux command at

You don't need the plural on "years" for the date parsing here, nor the spaces actually: at now+1000year is 15 bytes and does the same work.

@ceving @Caleb I'm not familiar with this language, but why not use at now+999year? An error of less than ±10% is allowed.

Python 3, all platforms, 91 bytes
from datetime import *;z=datetime.now()+timedelta(days=365242)
while z>datetime.now(): pass

The rules say simple termination is fine, which happens after the while loop is done. I couldn't put it all on one line, because the while loop has to start on its own line for the interpreter to recognize it. I also didn't want to use sleep since the challenge specifically calls that out as the problem.

The spaces before * and after : are not necessary. Instead of pass you can use a simple value, the shortest would be a single digit number.

Factor, 10 bytes
3e16 sleep

Try it online!
Factor's sleep word is a generic word that can take either a real number denoting nanoseconds or a duration. 3e16 nanoseconds is within 5% error of 1000 years if my calculations are correct.
More straightforward at the cost of some bytes:
Factor, 15 bytes
1e3 years sleep

Try it online!

Stax, 8 7 6 bytes
ê¼@µ~¼

Run and debug it
Approach
17¹⁰ times: wait for one animation frame at 60fps.
Here's a test for 10 seconds.

Commodore BASIC (Commodore C64/128, C16/+4, VIC-20, CBM/PET), 92 Tokenised BASIC bytes
A thousand years in the Gregorian Calendar at least 365,240 days, plus two or three days depending on the 400 year rule, whereby each start of a new century is a leap year but only once every 400 years, with the year 2000 being a leap year, but 1900 and 2100 are not leap years. As the next leap year at the start of a century will be 2400 I will assume that you want to sleep for 365,242 days. How do we do this with Commodore BASIC?
A day according to a Commodore BASIC interpreter is 5,184,001 jiffies (or 1/60 of a second), which is actually one 60th too many, so over 365,242 days, we are out by the same number of jiffies, which is about 101 minutes, so we will be sleeping for about 1000 years + 101 minutes based on our assumptions above. You can see an explanation of the Commodore TI and TI$ functions on the 8-BIT Show and Tell YouTube channel here.
Firstly, we need to take a copy of the current system time, which one can set in HHMMSS in a 24 hour format like TI$="123000" - we then need a busy loop to wait a second so that the copy of the current time and the system timer are not the same. I am also setting the number of days to wait in the W variable, which is 365241 as our counter D starts at zero.
0 C$=TI$: W=365241: D=0: FOR I=0 TO 937: NEXT I

Now, we need to wait until TI$ is equal to our copy stored in C$, each time it is we know that it has been 24 hours and 1/60th of a second. When this is true, we can jump to a sub routine that will add 1 to the number of days, and return. Note that using STEP 0 in our FOR/NEXT loop creates an endless loop with our break condition being in the subroutine on line 2.
1 FOR I=0 TO 1 STEP 0: ON -(TI$=C$) GOSUB 2: NEXT I

When we jump to the subroutine at line 2, TI$ and C$ may still contain the same values, so we need a busy loop until TI$ is one second ahead again of C$. Then we can add 1 to our day counter, and if the counter has fewer days than our W variable set above, we will return from our sub-routine which will wait again until another 24 hours and 1 jiffy has passed.
2 ON -(TI$=C$) GOTO 2: D=D+1: IF D<W THEN RETURN

The full crunched listing (with removed whitespaces) would look like this:
0C$=TI$:W=365241:D=.:FORI=.TO1E3:NEXT
1FORI=.TO1STEP.:ON-(TI$=C$)GOSUB2:NEXT
2ON-(TI$=C$)GOTO2:D=D+1:IFD<WTHENRETURN

YASEPL, 31 bytes
=aŔ9+31556952000000`1=bŔ9}2,a

terminates when finished.
sets a date to a, adds 1000 years in milliseconds, then goes into a while loop that checks if the current date is less than a. aka:
let a = new Date() + 31556952000000;

do {
  let b = new Date();
} while(b < a);

Uiua, 7 bytes
&sl3e10

Explanation
&sl3e10
   3e10 # Push 30000000000 to the stack
&sl     # Sleep for that many seconds

On Uiua's online pad, &sl hangs the page for how many seconds specified. Here's a sample that hangs for 10 seconds.
Unfortunately, 3e10 seconds is only around 951 years, so everyone'll have to wait 49 more. Thankfully it's only 95.07% of a millennium in seconds.

Scratch (scratchblocks3 syntax), 30 bytes
It's the obvious solution but it's surprisingly short for a Scratch program. Sleeps for exactly 951.3 years + a few milliseconds.
when gf clicked
wait(3e10)secs

I don't think it'd be a few milliseconds, since you're giving it an integer amount of seconds?

@noodleman Scratch adds a small artificial delay after each block

Ah, forgot about the delay.

Pascal, 284 B
This complete Pascal program requires a processor supporting features defined by ISO standard 10206 “Extended Pascal”, in particular the timeStamp built‑in data type and getTimeStamp routine.
The program simply performs a busy wait.
program p;var r,n:timeStamp;begin getTimeStamp(r);with r do begin
year:=year+1000;day:=day-ord(month=2)*ord(not(0 in[year mod 4]-[year mod 100]+[year mod 400]));repeat
getTimeStamp(n)
until[1=1]=[n.year=year,n.month=month,n.day=day,n.hour=hour,n.minute=minute,n.second=second]end end.

The program terminates if exactly 1 kiloyears have passed (second granularity), else it is non‑terminating (for instance if the operating system’s scheduler put the program in a waiting state during the crucial second).
program millenniumSleep;
    var
        reference, now: timeStamp;
    begin
        getTimeStamp(reference);
        { We presume `reference.dateValid` and `reference.timeValid` are `true`.
          The processor does feature an operational real‑time clock. }

        with reference do
        begin
            { Add a millennium to `timeStamp`. }
            year ≔ year + 1000;
            { Accommodate for leap day. }
            day  ≔ day − ord(month = 2) *
                ord(not (0 in [year mod 4] − [year mod 100] + [year mod 400]));

            { We presume evaluation of the loop takes at most one second. }
            repeat
            begin
                getTimeStamp(now);
            end
            { The embracing `with reference do` language construct
              allows us to abbreviate `reference.year` to `year` and so forth. }
            until [true] = [now.year = year, now.month = month, now.day = day,
                now.hour = hour, now.minute = minute, now.second = second]
        end
    end.

The leap year test has been adopted from a different challenge.
The program needs to be started before the year maxInt − 1000.
The value of the built‑in constant maxInt is implementation‑defined.

Kotlin, 25 bytes
{Thread.sleep(7L shl 42)}

111 followed by 41 zeros (binary) is ~97.56% of 31556952000000 (decimal)
Try it online!


text:
Polyglot Iterative Quine
Introduction
A polyglot is a program that is valid in multiple languages at once. An iterative quine is a program that outputs another program that outputs another program that outputs the source of the original program. Note that the number of chained programs does not have to be 3; it could be 2, 4, or 97384.
Challenge
Your task is to write a polyglot iterative quine. Each program in the program chain must be a polyglot.

Each of your programs must take no input.
As stated above, each of the programs must output the source of the next program in the chain. The last program in the chain must output the source code of the first program.

Scoring
Your score is calculated as follows:

For each program in the chain, take the number of languages it is valid in. Sum the results.
Sum the byte count of each program in the chain.
Divide the byte count by the number from the first program.

Rules

The length of the chain must be at least 2.
Each program in the chain must be valid in at least 2 languages.
The program with the lowest score wins.
"Different language" is defined as follows:

A language where the source code of the compiler or interpreter is not the same as another, and the compiler or interpreter does not run the same language as another. Some examples of different languages are: Python 2 and 3, C and C++, Java and C, and Lua and Ruby. However, by this definition, using tcc instead of gcc does not count as a different language, because tcc runs the same language as gcc: C.

Programs are allowed to throw errors, but only after they print out the output of the program. For example, print(1/0);print(<quine stuff>) in Python 3 would be invalid, but print(<quine stuff);print(1/0) would be.

In order for this sort of challenge to work it is going to need to be clear what counts as different languages.  Otherwise we get a lot of questions as to whether all versios of python are the same language, whether using different C compilers counts as using different language etc. Related reading

@WheatWizard - ok, I will fix that

this already won.

@Dracos18s Those aren't polyglots

Couldn't I just make a BF quine, and say it iterates through the hundreds of trivial BF variants?

No - if the BF variants are also able to compile a normal BF quine, then it can be said that they perform the same task as the original compiler, rendering them not different languages.

What do you mean by "number of languages it is valid in"? Number of languages where that source code can be run without errors? Or without syntax errors? Is print(1/0) considered valid in Python 3, for example?

I mean the number of languages it can be run in without throwing any errors. Compiler warnings are not counted.

If I prefix my code with a comment character (e.g. #, does my score suddenly decrease because it can be run  in hundreds of different languages with erroring? On the other hand, my ><> program works perfectly fine but terminates in an error (which is also fine by community standards). Perhaps you should just say the program has to output the next program in the sequence for each language and leave it at that?

@JoKing - ok, here is the new rule: the program must output the source of the next program without any errors beforehand. Any errors afterward, including terminating with an error, are fine.

Is that any different to just saying that it has to output the source of the next program, without all the stuff about errors? Also, make sure to add these corrections to the question itself

@JoKing - good point. I will edit the question.

Wumpus, ><>, Befunge-98, \$\frac{57+57}{3+3}=19\$
"]<0~[#34ooo!O;#53&o@,k*4e-1#'$ #o#!-1'#'+3*a9*c5+*68%2++

Try it in Wumpus! Try it in ><>! Try it in Befunge-98!
A modified version of a previous polyglot of mine that makes it iterative by flipping the first 0 to a 1 and back again.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Longest Prime Sums
Sandbox
There are special sets S of primes such that \$\sum\limits_{p\in S}\frac1{p-1}=1\$. In this challenge, your goal is to find the largest possible set of primes that satisfies this condition.
Input: None
Output: A set of primes which satisfies the conditions above.
This challenge is a code-challenge, where your score is the size of the set you output.
Examples of Valid Outputs and their scores
{2} - 1
{3,5,7,13} - 4
{3,5,7,19,37} - 5
{3,5,7,29,31,71} - 6

Important: This challenge doesn't require any code, simply the set. However, it would be helpful to see how you generated your set, which probably involves some coding.
Edit: Found the math.stackexchange post that inspired this thanks to @Arnauld

This challenge doesn't require any code - would this be better asked in puzzling.SE?

@DigitalTrauma No, since this challenge is clearly meant to be attempted via efficient searches through primes. Which isn't relevant in puzzling. I think this could produce some interesting approaches (I found these examples via a modified greedy algorithm over a prime list).

@DonThousand Is it correct that you require the solution to be a set (e.g. all elements are distinct)? Or is a list of primes (with recurring values) also acceptable? I (possibly wrongly) assumed in my answer that repetitions were allowed. If not, I'll change my answer.

@Arnauld Yes it was! I was looking for the question I commented on, but I couldn't find it. Sheesh.

@agtoever It's a set. It must be distinct. I see you've already made that change, so that's good.

I agree with @DigitalTrauma that this should be on puzzling.SE. They specifically have a 'no-computers' tag which to me implies that puzzles requiring computers are acceptable there.

@SamDean No, that's not true. Open ended challenges like this are strictly off topic there. Problems must have a single definite answer to be posted there. Please read their FAQ

Score 100 8605
I used an algorithm that starts with one solution and repeatedly tries to split a prime \$p\$ in the solution into two other primes \$q_ 1\$ and \$q_ 2\$ that satisfy \$\frac1{p-1} = \frac1{q_1-1}+\frac1{q_2-1}\$.
It is known (and can be quickly checked) that the positive integer solutions to \$\frac1n = \frac1x + \frac1y\$ are in one-to-one correspondence with factorizations \$n^2 = f_ 1 f_ 2\$, the correspondence being given by \$x = n + f_ 1\$, \$y = n + f_ 2\$. We can search through the factorizations of \$(p-1)^2\$ to see if any of them yielded a solution where both new denominators \$x,y\$ were one less then primes; if so, then \$p\$ can be replaced by \$q_1=x+1\$, \$q_2=y+1\$. (If there were multiple such factorizations, I used the one where the minimum of \$q_1\$ and \$q_2\$ was smallest.)
I started with this seed solution of length 44:
seed = {3, 7, 11, 23, 31, 43, 47, 67, 71, 79, 103, 131, 139, 191, 211, 239, 331, 419, 443, 463, 547, 571, 599, 647, 691, 859, 911, 967, 1103, 1327, 1483, 1871, 2003, 2311, 2347, 2731, 3191, 3307, 3911, 4003, 4931, 6007, 6091, 8779}

This seed was found using an Egyptian fraction solver that a former research student of mine, Yue Shi, coded in ChezScheme. (The primes \$p\$ involved all have the property that \$p-1\$ is the product of distinct primes less than 30, which increased the likelihood of Shi's program finding a solution.)
The following Mathematica code continually updates a current solution by looking at its primes one by one, trying to split them in the manner described above. (The number 1000 in the third line is an arbitrary stopping point; in principle one could let the algorithm run forever.)
solution = seed;
j = 1; (* j is the index of the element of the solution that we'll try to split *)

While[j <= 1000 && j <= Length[solution],
  currentP = solution[[j]];
  allDivisors = Divisors[(currentP - 1)^2];
  allFactorizations = {#, (currentP - 1)^2/#} & /@
    Take[allDivisors, Floor[Length[allDivisors]/2]];
  allSplits = currentP + allFactorizations;
  goodFactorizations = Select[allSplits,
    And @@ PrimeQ[#] && Intersection[#, solution] == {} &];
  If[goodFactorizations == {},
    j++,
    solution = Union[Complement[solution, {currentP}], First@goodFactorizations]
  ]
]

The code above yields a solution of length 4126, whose largest element is about \$8.7\times10^{20}\$; by the end, it was factoring integers \$(p-1)^2\$ of size about \$8.8\times10^{21}\$.
In practice, I ran the code several times, using the previous output as the next seed in each case and increasing the cutoff for j each time; this allowed for the recovery of some small prime splits that had become non-redundant thanks to previous splitting, which somewhat mitigated the size of the integers the algorithm factored.
The final solution, which took about an hour to obtain, is too long to fit in this answer but has been posted online. It has length 8605 and largest element about \$4.62\times10^{19}\$.
Various runs of this code consistently found that the length of the solution was about 3–4 times as long as the set of primes that had been examined for splitting. In other words, the solution was growing much faster than the code scanned through the initial elements. It seems likely that this behavior would continue for a long time, yielding some gargantuan solutions.

Reading this discouraged me from competing, because you know your stuff so well

Oh I don't want anyone to be discouraged! Note that agtoever blew my original answer out of the water :)

@GregMartin In my opinion, you deserve the accepted answer. Not only have you discovered a much larger set, but also an even more effective and efficient algorithm. Well done. Kudos.

@agtoever Thanks for the kind words :) Your answer is very worthy and also was the first to have the code up; speed of posting is a consideration factor and I'm content for that to be the case.

@GregMartin Wow, what a read. This is honestly incredible. I wish I could give the both of you the checkmark.

It took me a while to realize this solution is simple enough that I can understand it. The only thing I find incomprehensible is that the primes are dense enough that you can consistently find more to split. How does the scaling work; do you ever run out of splitting possibilities?

I am surprised to see you finding Divisors[(currentP - 1)^2] rather than constructing that list from Divisors[currentP - 1].

@JollyJoker I think it's an extremely interesting question whether a given seed can generate an infinite sequence of splits. My heuristics tell me that a randomly chosen large prime is unlikely to have such splits; however, primes such that p–1 is very composite have a better chance to have such splits, and it might be the case that this algorithm tends to produce primes of that form.

@EricTowers Some brief experimentation indicates to me that reconstructing the divisors of (p–1)^2 from the divisors of p–1 takes longer than just finding the divisors of (p–1)^2 directly. I'd be happy to be convinced otherwise though

For further analysis, I think it’s relevant to note that there are primes p that don’t have 2 other primes q1 and q2 for which 1/(p-1) = 1/(q1-1) + 1/(q2-1). 2 is a trivial example. They may mean that there is a limit for this algorithm, where all primes can’t be factored. It would be interesting to know if such a limit exists...

Using FactorInteger on (currentP - 1/2) to construct the divisor pairs, I can cut the time of the allDivisors to goodFactorizations block by a factor of 2-3 for currentP in $10^{11}$ to $10^{22}$ (with a smaller, but better than $1$ factor for smaller primes).  I don't see a good way to communicate this improvement; I'll post it as an answer, but it risks being deleted, since it is not actually one.

Speed-up posted as https://codegolf.stackexchange.com/a/197067/42612

Score 263 385 425 426 with only primes < 1.000.000 (was: non-competitive, now it is; score can be increased by running the program longer)
I followed the same path as Wheat Wizard: iteratively search for primes in the solution that can be replaced with a longer list of primes with the same result. I wrote that Python program that does exactly this. It starts with solution S = {2} and than iterates of all elements of that solution and tries to find a decomposition of that prime for which 1/(p-1) = sum(1/(q-1) for all q in the decomposition.
After I realized that S should be a set (and not a list), I altered the program to take this into account. I also added a ton of performance optimizations. The solution of 263 came up within 200 seconds or so (running under pypy3), but if you let it running, it steadily keeps coming with additional (longer) solutions.
Current best solution (425 elements, with all primes < 1M, calculated in ~ 15 min.):
S = [3, 5, 13, 19, 29, 37, 103, 151, 241, 281, 409, 541, 577, 593, 661, 701, 751, 1297, 1327, 2017, 2161, 2251, 2293, 2341, 2393, 2521, 2593, 2689, 2731, 3061, 3079, 3329, 3361, 3457, 6301, 6553, 7057, 7177, 7481, 7561, 8737, 9001, 9241, 9341, 10501, 11617, 12097, 12547, 14281, 14449, 14561, 15121, 17761, 17851, 18217, 18481, 20593, 21313, 22441, 23189, 23761, 24571, 26041, 26881, 28351, 28513, 29641, 30241, 36529, 37441, 46993, 49921, 51169, 57331, 58109, 58313, 58369, 58831, 59659, 60737, 60757, 61001, 61381, 61441, 61561, 61609, 63067, 63601, 64513, 64901, 65053, 65089, 65701, 65881, 66301, 66931, 67049, 69389, 69941, 70181, 72161, 72481, 72577, 72661, 73061, 73699, 74521, 77521, 78241, 79693, 81181, 86951, 88741, 90631, 98011, 100297, 102181, 107641, 108991, 109201, 109537, 114913, 117841, 118429, 121993, 122761, 123001, 124561, 127601, 128629, 130073, 130969, 131561, 133387, 133813, 138181, 138403, 139501, 146077, 149521, 159457, 160081, 162289, 163543, 166601, 174241, 175891, 176401, 177913, 180181, 182711, 189421, 199921, 201781, 206641, 218527, 223441, 227089, 229739, 234961, 238081, 238141, 238897, 239851, 246241, 250057, 261577, 266401, 267961, 280321, 280837, 280897, 281233, 283501, 283861, 284161, 287233, 288049, 291721, 297601, 299053, 302221, 306853, 309629, 313153, 316681, 322057, 325921, 332489, 342211, 342241, 349981, 352273, 354961, 355321, 360977, 365473, 379177, 390097, 390961, 394717, 395627, 401057, 404251, 404489, 412127, 412651, 416881, 417649, 418027, 424117, 427681, 428221, 428401, 429409, 430921, 434521, 435481, 441937, 443873, 444641, 451441, 453601, 454609, 455149, 459649, 466201, 468001, 473617, 474241, 480737, 481693, 483883, 496471, 498301, 498961, 499141, 499591, 499969, 501601, 501841, 502633, 513067, 514513, 517609, 523261, 524521, 525313, 529381, 538721, 540541, 545161, 550117, 552553, 560561, 562633, 563501, 563851, 568177, 570781, 575723, 587497, 590669, 591193, 599281, 601801, 601903, 604001, 605551, 607993, 609589, 611389, 617401, 621007, 627301, 628561, 628993, 629281, 635449, 637201, 639211, 642529, 645751, 651361, 651857, 653761, 654853, 655453, 657091, 662941, 664633, 667801, 669121, 669901, 670177, 673201, 673921, 675109, 688561, 689921, 691363, 692641, 694033, 695641, 697681, 698293, 700591, 703081, 703561, 705169, 705181, 707071, 709921, 713627, 732829, 735373, 737413, 739861, 742369, 745543, 750121, 750721, 754771, 756961, 757063, 758753, 759001, 760321, 761671, 762721, 766361, 773501, 774181, 776557, 779101, 782461, 784081, 784981, 786241, 788317, 794641, 795601, 797273, 800089, 801469, 808081, 808177, 810151, 813121, 815671, 819017, 823481, 823621, 825553, 831811, 833281, 833449, 836161, 839161, 840911, 846217, 859657, 859861, 860609, 863017, 865801, 869251, 870241, 875521, 876929, 878011, 880993, 884269, 891893, 895681, 898921, 899263, 902401, 904861, 905761, 907369, 908129, 914861, 917281, 917317, 921601, 922321, 923833, 926377, 939061, 941641, 942401, 943009, 943273, 944161, 944821, 944833, 949621, 949961, 950041, 950401, 953437, 953443, 954001, 957349, 957529, 960121, 960961, 963901, 964783, 967261, 967627, 967751, 968137, 971281, 973561, 973591, 984127, 984341, 984913, 986437, 991381, 992941, 994561, 995347, 996001]

Proof that is satisfies the challenge:
Some of the decompositions used:
1/(  2-1) = sum(1/(p-1)) for p in: {(5, 7, 13, 3)}
1/(  3-1) = sum(1/(p-1)) for p in: {(7, 13, 5)}
1/(  5-1) = sum(1/(p-1)) for p in: {(13, 7)}
1/(  7-1) = sum(1/(p-1)) for p in: {(13, 19, 37)}
1/( 13-1) = sum(1/(p-1)) for p in: {(19, 37)}
1/( 19-1) = sum(1/(p-1)) for p in: {(29, 71, 181)}
1/( 29-1) = sum(1/(p-1)) for p in: {(37, 127)}
1/( 37-1) = sum(1/(p-1)) for p in: {(43, 281, 2521)}
1/( 43-1) = sum(1/(p-1)) for p in: {(53, 223, 13469)}
...
1/(8779-1) = sum(1/(p-1)) for p in: {(8969, 739861, 941641)}
1/(8807-1) = sum(1/(p-1)) for p in: {(9001, 773501, 865801)}
1/(8821-1) = sum(1/(p-1)) for p in: {(8941, 657091)}
1/(8941-1) = sum(1/(p-1)) for p in: {(9041, 808177)}
1/(8969-1) = sum(1/(p-1)) for p in: {(9463, 227089, 705169)}
1/(9001-1) = sum(1/(p-1)) for p in: {(9109, 759001)}
1/(9041-1) = sum(1/(p-1)) for p in: {(9241, 417649)}
1/(9109-1) = sum(1/(p-1)) for p in: {(10891, 55661)}
1/(9181-1) = sum(1/(p-1)) for p in: {(9343, 529381)}
1/(9241-1) = sum(1/(p-1)) for p in: {(9341, 863017)}
1/(9341-1) = sum(1/(p-1)) for p in: {(15121, 25219, 784561)}
1/(9343-1) = sum(1/(p-1)) for p in: {(9689, 261577)}
1/(9463-1) = sum(1/(p-1)) for p in: {(10957, 69389)}
1/(9689-1) = sum(1/(p-1)) for p in: {(12457, 43597)}
1/(10333-1) = sum(1/(p-1)) for p in: {(10501, 645751)}
...
1/(131561-1) = sum(1/(p-1)) for p in: {(237361, 295153)}
1/(166601-1) = sum(1/(p-1)) for p in: {(243433, 527851)}
1/(266401-1) = sum(1/(p-1)) for p in: {(386401, 857809)}
1/(355321-1) = sum(1/(p-1)) for p in: {(639577, 799471)}

Python3 code:
import itertools
import sympy
import cProfile
import functools
import bisect
import operator

def sundaram3(max_n):
    # Returns a list of all primes under max_n
    numbers = list(range(3, max_n + 1, 2))
    half = (max_n) // 2
    initial = 4
    for step in range(3, max_n + 1, 2):
        for i in range(initial, half, step):
            numbers[i - 1] = 0
        initial += 2 * (step + 1)
        if initial > half:
            return [2] + list([_f for _f in numbers if _f])

# Precalculate all primes up to a million to speed things up
PRIMES_TO_1M = list(sundaram3(1000000))

def nextprime(number):
    # partly precalculated fast version for calculating the
    # first (e.g. smallest) prime that is largest than numer
    global PRIMES_TO_1M

    if number <= PRIMES_TO_1M[-2]:
        return PRIMES_TO_1M[bisect.bisect(PRIMES_TO_1M, number)]
    return sympy.nextprime(number)

def isprime(number):
    # partly precalculated fast version to determine of number is prime
    global PRIMES_TO_1M

    if number < 1000000:
        return number in PRIMES_TO_1M
    return sympy.isprime(number)

def upper_limit(prime, length=2):
    # Returns the largest prime q in the decomposition of prime with the given
    # length such that 1 / (prime - 1) = sum( 1 / (q - 1)) for q in
    # set V, with V has the given length.
    # ASSUMPTION: all q are unique; this assumption is not validated,
    # but for this codegolf, the solution must be a set, so this is safe.
    if length == 1:
        return prime
    nextp = nextprime(prime)
    largestprime = (prime * nextp - 2 * prime + 1 ) // (nextp - prime)
    if not isprime(largestprime):
        largestprime = nextprime(largestprime)
    return upper_limit(largestprime, length - 1)

def find_decomposition(prime, length=2):
    # Returns a list of primes V = {q1, q2, q3, ...} for which holds that:
    # 1 / (prime - 1) = sum(1 / (q - 1)) for q in V.
    # Returns None if this decomposition is not found.
    # Note that there may be more than one V of a given prime, but this
    # function returns the first found V (implementation note: the sortest one)
    print(f"Searching decomposition for prime {prime} with length {length} in range ({prime}, {upper_limit(prime, length)}]")
    prime_range = PRIMES_TO_1M[bisect.bisect(PRIMES_TO_1M, prime) + 1:
                               bisect.bisect(PRIMES_TO_1M, upper_limit(prime, length) + 1)]
    # we only search for combinations of length -1; the last factor is calculated
    for combi in itertools.combinations(prime_range, length - 1):
        # we find the common factor of prime and all primes in combi
        # and use that to calculate the remaining prime. This is faster
        # than trying all prime combinations.
        factoritems = [-prime + 1] + [c - 1 for c in combi]
        factor = -functools.reduce(operator.mul, factoritems)
        remainder = - factor / sum(factor // p for p in factoritems) + 1
        if remainder == int(remainder) and isprime(remainder) and remainder not in combi:
            combi = combi + (int(remainder),)
            print(f"Found decomposition: {combi}")
            return combi
    return None

def find_solutions():
    # Finds incrementally long solutions for the set of primes S, for which:
    # sum(1/(p-1)) == 1 for p in S.
    # We do this by incrementally searching for primes in S that can be
    # replaced by longer subsets that have the same value of sum(1/p-1).
    # These replacements are stored in a dictionary "decompositions".
    # Starting with the base solution S = [2] and all decompositions,
    # you can construct S.
    decompositions = {}  # prime: ([decomposition], max tried length)
    S = [2]
    old_solution_len = 0

    # Keep looping until there are no decompositions that make S longer
    while len(S) > old_solution_len:
        # Loop over all primes in S to search for decompositions
        for p in sorted(set(S)):
            # If prime p is not in the decompositions dict, add it
            if p not in decompositions:
                decompositions[p] = (find_decomposition(p, 2), 2)
            # If prime p is in the decompositions dict, but without solution,
            # try to find a solution 1 number longer than the previous try
            elif not decompositions[p][0]:
                length = decompositions[p][1] + 1
                decompositions[p] = (find_decomposition(p, length), length)
            # If prime p is in decompositions and it has a combi
            # and the combi is not already in S, replace p with the combi
            elif all(p not in S for p in decompositions[p][0]):
                old_solution_len = len(S)
                print(f"Removing occurence of {p} with {decompositions[p][0]}")
                S.remove(p)
                S.extend(decompositions[p][0])
                S = sorted(S)
                break  # break out of the for loop
        print(f"Found S with length {len(S)}: S = {S}")
        print(f"Decompositions: ")
        for prime in sorted(decompositions.keys()):
            print(f"    1/({prime:3}-1) = sum(1/(p-1)) for p in: \u007b{decompositions[prime][0]}\u007d")

def main():
    cProfile.run("find_solutions()")

if __name__ == "__main__":
    main()

Using your function, you could decompose the twenty 43s into twenty 47, 491, 33811, increasing the score by 40. Also, the sixteen 73s can go to sixteen times 79, 1093, 6553, adding another 32 to your score

@LuisMendo altered the code, added solution. To all who downvoted: please let me know you find anything non-competing about this answer. I believe this is now a valid (and sound) answer. I'll edit some code comments later to explain the algorithms used.

@Arnauld you are right, I think. Fixed that.

Impressive score!

Woops, sorry we edited at the same time. Feel free to changes the removing/replacing again, my bad. I added Python highlighting to your answer so it's easier to read the code and comments of your program.

Score 32 34 36
{5, 7, 11, 13, 17, 23, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 101, 113, 131, 137, 151, 211, 229, 241, 281, 313, 379, 401, 433, 457, 491, 521, 571, 601, 25117, 293362609}

This is an improvement of Arnauld's answer.  I just noticed that
\$
\dfrac{1}{19-1}=\dfrac{1}{73-1}+\dfrac{1}{61-1}+\dfrac{1}{41-1}
\$
But 41 and 61 were already used in Arnauld's answer so I had to then figure out that
\$
\dfrac{1}{61-1} = \dfrac{1}{151-1} + \dfrac{1}{101-1}
\$
and
\$
\dfrac{1}{41-1} = \dfrac{1}{281-1}+\dfrac{1}{211-1}+\dfrac{1}{151-1}+\dfrac{1}{101-1}
\$
But now I am using 151 and 101 twice. So I spent some time and discovered that
\$
\dfrac{1}{151-1} = \dfrac{1}{401-1} + \dfrac{1}{241-1}
\$
and
\$
\dfrac{1}{101-1} = \dfrac{1}{601-1} + \dfrac{1}{571-1} + \dfrac{1}{457-1} + \dfrac{1}{229-1}
\$
So now I can just replace the 19 with 71, 151, 101, 151, 211, 229, 241, 281, 401, 457, 471, 601 and the sequence will maintain it's properties.
I also discovered that I can replace 19 with the sequence 71, 151, 101, 151, 211, 241, 241, 281, 401, 433, 541, 601, but that has 241 twice.
After that improvement I also noticed that 79 could be replaced with 521, 313, 131, to increase the size by 2 more.
And 73 can be replaced with 113, 379, 433 for another 2.

Score 22
Just to get the ball rolling.
{5,7,11,13,17,19,23,31,37,41,43,47,53,59,61,67,71,79,137,491,25117,293362609}

Compute the fraction
I suspect that the sequence can be made arbitrary large, but my code is currently too messy and inefficient for anything significantly better than that.

Most mathematicians suspect that as well, however, that claim is equivalent to a weak form of a long unsolved conjecture.

@DonThousand Can you link to what is known/suspected mathematically? What is the conjecture you refer to?

@Anush I'll try to find the paper. It was quite a while ago.

This non-answer expands on the modifications to @GregMartin's answer referenced in this comment there.
The allDivisors to goodFactorizations block can be sped up noticeably by not asking Divisors to factor the square of a number (and also a few other changes).  The @GregMartin's original code:
divMethod[p_] := Module[{},
   allDivisors = Divisors[(p - 1)^2];
   allFactorizations = {#, (p - 1)^2/#} & /@
      Take[allDivisors, Floor[Length[allDivisors]/2]];
   allSplits = p + allFactorizations;
   goodFactorizations = Select[allSplits,
      And @@ PrimeQ[#] &]
]

The intersection check at the end is removed, since it is common to both the above and my proposed replacement:
g[p_] := Module[
   {pm1s, factorization, divisors},
   pm1s = (p - 1)^2;
   (* Since the original seed contains only odd
      primes, we know one factor of p-1. *)
   factorization = FactorInteger[(p - 1)/2];
   (* For divisors d1, d2, such that d1 d2 = pm1s,
      we require d1+p and d2+p are prime.  p>2, so p
      is odd and both d1+p and d2+p are odd, so d1
      and d2 are necessarily both even.  This means
      we only consider splitting the powers of 2 so
      that at least one falls in each divisor; we
      want to know the power of 2 in pm1s, minus 1.
      *)
   If[factorization[[1, 1]] != 2,
      pow2m1 = 1,
      pow2m1 = 2 factorization[[1, 2]] + 1
   ];
   divisors = Outer[Times,
      2^Range[1, pow2m1],
      Sequence @@ (
         Select[
            #[[1]]^Range[0, 2 #[[2]]],
            (# < p - 1 &)] & /@
         Rest[factorization])];
   (* The Join@@ is a hack to deal with Reap's
      denormalized output on no-Sow runs.  See
      https://mathematica.stackexchange.com/questions/67625/what-is-shorthand-way-of-reap-list-that-may-be-empty-because-of-zero-sow *)
   Join @@ Reap[
      Map[
         (If[#1 < p - 1 && PrimeQ[#2],
            (If[PrimeQ[#2],
               Sow[{#1, #2}]
               ] &)[#2, pm1s/#1 + p]
            ] &)[#, # + p] &,
         divisors,
         {-1}];
      ][[2]]
]

Note: the replacement makes no attempt to sort the collection of pairs.  The following tests do not demonstrate the potential difference in order of results from divMethod and g.
divMethod[3]
g[3]
(* {} *)
(* {} *)

divMethod[29]
g[29]
(* {{31, 421}, {37, 127}} *)
(* {{31, 421}, {37, 127}} *)

p = NextPrime[10^3]
RepeatedTiming[divMethod[p]]
RepeatedTiming[g[p]]
(* {0.00041, {{1201, 6301}}} *)
(* {0.000487, {{1201, 6301}}} *)

p = NextPrime[10^6]
RepeatedTiming[divMethod[p]]
RepeatedTiming[g[p]]
(* {0.000271, {}} *)
(* {0.0000619, {}} *)

p = NextPrime[10^9]
RepeatedTiming[divMethod[p]]
RepeatedTiming[g[p]]
(* {0.000271, {}} *)
(* {0.000103, {}} *)

Let's collect timing data for sets of 1000 consecutive primes starting at powers of 10 and see what trends we see.
divTiming = Table[{10^k, RepeatedTiming[
   p = NextPrime[10^k];
   For[count = 1, count <= 1000, count++,
      divMethod[p];
      p = NextPrime[p];
   ]
 ][[1]]}, {k, 3, 22}];

fiTiming = Table[{10^k, RepeatedTiming[
   p = NextPrime[10^k];
   For[count = 1, count <= 1000, count++,
      g[p];
      p = NextPrime[p];
   ]
 ][[1]]}, {k, 3, 22}];

ListLogLinearPlot[{divTiming, fiTiming},
   PlotLegends -> {"Divisors", "FactorInteger"}]

ListLogLinearPlot[
   Transpose[{
      divTiming[[All, 1]],
      (divTiming/fiTiming)[[All, 2]]}],
   PlotLegends -> {"Divisors/FactorInteger"}]

So around 10^7 or 10^8, the Divisors method is noticeably slower than the FactorInteger method.  The ratio of times rises to 3-ish for primes around 10^15.  There is a dip, for slightly larger primes, but the trend suggests the speed-up will improve as we go to larger primes than tested.

Wow, this is some really cool analysis. Is this all done in R?

@DonThousand : This is Mathematica code, as is @GregMartin's.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Largest smallest gap
Write a function or program which takes as input a set of distinct, non-negative integers \$\{x_1, \ldots, x_n\}\$ and outputs the smallest gap between any two values in the set, i.e. \$\min_{i\neq j}|x_i-x_j|\$.
Scoring
This is not code golf. Your score is the smallest gap of the set of code points of characters in your code (highest score wins). In other words: convert your code to integer code points (using ASCII or whatever code page is standard for your language); remove duplicates; use that as input to your program; the output is your score.
For instance, if your code is min(alldifferences(input)), to get your score convert m->109, i->105, n->110, (->40, ... and your score will be 1, since the codepoints for m and n are only 1 apart.
You may assume that the input contains at least 2 distinct values; behaviour is undefined otherwise. Your code must include at least two distinct characters.
If your encoding is ASCII, you can use this online R code to verify your score.
Test cases
Input         | Output
0 1 2 3 4     | 1
2 4 8 16 32   | 2
1             | undefined
3 14 159 2653 | 11
4 6 8 9 12 14 | 1
3 14 2        | 1

Default rules for input/output apply. In particular, since the input is a set, you may assume any structure for the input.

Something that I just understood: we remove duplicates when scoring our code, but we get distinct integers when it’s normal inputs. So we don’t have to remove duplicates ourselves in the code, right?

@Fatalize That's correct: the input is made of distinct integers.

Suggested test case: [3,14,2]. Output should be 1, right?

@Fatalize Yes. Edited in.

Unary, Lenguage like language may get any large score if they are allowed. Otherwise, answers in languages like Aheui, PerlYuYan would win this challenge. But sadly I can speak none of them.

@LuisMendo Yes, largest score wins. It is already in the text, in bold. :-)

@tsh Agreed. I don't find answers in Unary and Lenguage very interesting for this challenge. I have added your suggestion.

@Robin Ah, sorry, I hadn’t seen it

Where a language has its own codepage, can we opt to use UTF-8? Or do we have to use the language-specific codepage?

@NickKennedy If the language has its own codepage, you may use ASCII if all your characters are ASCII, but you may not use UTF-8.

Unfortunately, since braces pairs ((), [],{}) and the lambda expression symbols (=>) are consecutive (or 1 apart for the case of {}), it seems impossible to get a score of more than 1 for most "non-golf" languages - Any chance to relax the scoring a bit so that these symbols are ignored?

@G0BLiN [] are also 2 apart, like {}. I agree this makes the challenge difficult, but adding exceptions would defeat the point of the challenge. Non-golfing languages should probably aim for a score of 2 or 3. For instance, R makes a heavy use of (), but I have an (unposted) R solution with a score of 2, which was fun to work on.

Robin Ryder - it's your question :). My point is that any answer in a non-golfing answer is likely to reach the highest score possible without much effort - while with the relaxation of e.g. ignoring braces, these suddenly there's a possibility to reach a higher than trivial score - so there's a challenge, a competition and things become more interesting...

05AB1E, score: 22 49 69 (5 4 bytes)
ê¥êн

Uses the 05AB1E encoding, where the bytes have the codepoints [234,165,234,14] (ê¥ are 69 apart).
+27 score by porting @Arnauld's approach of sorting.
+20 score (and even -1 byte at the same time) thanks to @Grimmy.
Try it online or verify all test cases.
Explanation:
ê     # Sort and uniquify the (implicit) input-list (in ascending order)
 ¥    # Get the deltas of this sorted list
  ê   # Sort and uniquify this again
   н  # Pop this list and push its first item
      # (which is output implicitly as result)

ê¥êн scores 69.

@Grimmy, isn't 7 (172-165)?

@NahuelFouilleul No.

@Grimmy Very nice, not only do you increase the score, but it also saves a byte if this were a code-golf challenge. Thanks!

Brachylog, Score = 12
⊇ᶠl₂ˢ-ˢȧˢ⌋

Try it online!
The minimum gap is 12, between ⊇ and ⌋, and also between ᶠ and ˢ (see the code page).
Explanation
⊇ᶠ             Find all subsets of the input
  l₂ˢ          Only keep those that have a length of 2
     -ˢ        Compute the difference of each subset
       ȧˢ      Compute the absolute value of each difference
         ⌋     Output is the smallest one

Charcoal, 13 bytes, score 3
Ｉ⌊Ｅθ⌊ΦＥθ↔⁻ιλλ

Try it online! Link is to verbose version of code and takes the code's own code points as input. Explanation:
   θ            Input array
  Ｅ             Map over elements
       θ        Input array
      Ｅ         Map over elements
          ι     Outer element
           λ    Inner element
        ↔⁻      Take the difference
     Φ      λ   Filter out zero values
 ⌊  ⌊           Take the minimum of the minima
Ｉ               Cast to string for implicit print

Charcoal's loop variables are implicit but fortunately Map consumes two variables and even more fortunately there is no variable j so there is actually a minimum difference of 3.

Jelly, 5 bytes, score = 24
This is most probably sub-optimal. Uses Jelly code page.
ṢIṢ1ị

Try it online! (with the code points of the source code)
Commented
ṢIṢ1ị  - a monadic link taking a list, e.g. [183, 73, 49, 216]
Ṣ      - sort in ascending order -> [49, 73, 183, 216]
 I     - get increments -> [24, 110, 33]
  Ṣ    - sort in ascending order -> [24, 33, 110]
   1ị  - extract the first element -> 24

Gaia, 3 bytes, score = 36
ȯọ⌋

Try it online!
Uses the Gaia codepage. ȯọ are 36 apart.

MathGolf, score = 35
ê│╓

Try it online!
Uses MathGolf's codepage along with this simple Python script.
ê    Take user input as array of integers
 │   Take differences
  ╓  Find minimum

Japt -g, 6 bytes, score: 43
n¹än¹n

Try it (includes codepoints test case)

Jelly, score 53
’ÞIṂ

Try it online!
The code page is here. The code points are 253 20 73 179 which has minimal difference of 73-20=53 as may be seen in this self-evaluation.
How?
      ’ÞIṂ - Link: list of numbers, L     e.g. [253, 20, 73, 179]
 20:   Þ   - sort L by:
253:  ’    -   decrement                       [20, 73, 179, 253]
 73:    I  - incremental differences           [53, 106, 74]
179:     Ṃ - minimum                           53

Why does the Jelly wiki say that Þ is outer product/table and you say it's sort by?

Because there are two thorns in the code-page: 20 (Þ) = sort by key function; and 31 (þ) = outer product.

Ah, sorry, I didn't realise that my search was case insensitive...

MATL, Score 16
SdS9z)

Try it online!
For anything up to SdS) I could get a score of 17, but generating a 1 for indexing (because X< is too close to S) bumped the score down to 16.
Let's see if any ASCII-based language beats this...

Runic Enchantments, Score 1 (79 bytes)
D?)0]li[0y̤<<<<<<<<
Ro"/{~D-{:ii"6Xkq";$~\"akq"/~{R{0[il]0)?/:}S-:}}:{)?"E͍$;

Try it online!
(Note that due to the way input is coerced to the most appropriate type and we want decimal value 49 not decimal value 1 for such bytes; this applies to the newline, 0, 6 (etc), as well as the injection of all the spaces).
There's a few reasons I can't score higher. In decreasing order of troublesomeness.

@ and ? are adjacent (? is required for conditionals, @ is one of two terminators)
: and ; are adjacent (: is required to duplicate the top of the stack for non-destructive comparisons, ; is the other terminator)
< and ; are adjacent
> and ? are adjacent (using other entry points possible, but we're already score-limited, v is best option as ^ and ] are adjacent)
D and E are adjacent (replacing D with / or \ or not using Eval possible)
l and k are adjacent (l is required to read all input, k is required to inject a newline and entry point into the evaluated code; Eval not strictly needed)
} and ~ are adjacent (pop-discarding an arbitrary value without corrupting the stack is difficult otherwise, [] does work, but limits score to 2, assuming we could overcome the other points, 0*+ also works, but + and * are adjacent)
o and q limit score to 2
[ and ] limit score to 2 (but not strictly necessary, just simplifies the input reading process, but lril1- is still score limited to 3 on its own plus r and q are adjacent as well as 0 and 1)
l and o limit score to 3
pre-processing the code and injecting troublesome bytes with reflection necessitates a minimum of 2 of 1234567890, all of which are going to cause low score limits.

R, 47 bytes, score = 2
`-`=`mi\x6E`;`~`=diff;`?`=`s\x63\x61\x6E`;-~?""

Try it online!

The input is assumed to be unique and sorted ascending.
Verify the score here

Well done for the first answer with score >1 in a verbose language!

Jelly, 12 bytes, score = 35
ạ€`«/Ƈ€«/€«/

Try it online!
A monadic link taking a list of (optionally distinct) integers as its argument and returning the smallest gap. Generates an outer table of absolute differences between the inputs, filters out zero differences, finds the smallest in each row and then the smallest of those values. TIO link has a footer to translate the code into numeric codepoints within Jelly codepage (technically each is +1, but there is no effect on differences between pairs).
Pairwise differences shown here

C++, score : 1, bytes : 132
#include <cmath>
int f(int* a,int c){int m=abs(a[0]-a[1]),i,j,d;for(i=-1;++i<c;)for(j=i;++j<c;)m=(d=abs(a[i]-a[j]))<m?d:m;return m;}

The very need of the abs function kills my score, and any other C++ answer's.
It's actually return.
Try it online!

() being 1 apart also kills any C++ answers (in fact, very many practical languages will have a score of 1 due to this).

@79037662 Aww man

@VaradMahashabde I'm sorry - I was commenting on the other person's comment.  I wasn't making a suggestion to you.  I didn't mean to cause any confusion.  I've deleted my comment so that I don't confuse anyone else.

But return is usually unnecessary, as gcc produces a warning and then effectively returns the variable that was mentioned the last, and seems to return m here.

@mypronounismonicareinstate It would matter if this was code golf, but as @79037662 said, () kills any dreams right away. Also that is UB AF, and I don't like it when there is even a remote chance of a kitten beam being shot into space or a space beam being shot into a kitten :-)


text:
Count the length of head movement
Once upon a time I wanted to order custom tokens for a board game. They say they can do it, and then they present me their price list. I was confused because they charge per inch of head movement, and I have no idea how much will my tokens cost.
INPUT: a 2d grid:

|,-,\,/ are straight cuts. Each has a length of 1.
┌,┐,└,┘ are 90 degree corner cuts. Each has length of 1.\$^1\$
#,@ are 45 and 135 degree corner cuts respectively. Each has a length of 1.20.
+,X are perpendicularly intersecting cuts. Each has a length of 1.
>,v,<,^ are the cut ends. Each has a length of:

1.50, if the arrow points at the diagonal cut,
1, if the arrow points at the beginning of next cut,
0.50 otherwise.

ABC...UVWYZabc...xyz are the cut start points given in that order. They have a length of:

0.50, if no other already made cuts are neighboring them,
1.50, if if the cut begins next to the diagonal cut,
1 otherwise.

OUTPUT: Distance that a head will move with up to 2 significant digits.
Assume that:

The company doesn't count distance from resting position to starting point of the first cut,
Each cut is made only once (intersections cut twice on the same character),
All grids are valid,
The head moves from the end of a cut to the beginning of another cut in a straight line.

Obviously no standard loopholes, and the shortest code in each language wins!
TEST CASES:

Output: 0
A> B>

Output: 4
A------v
^------B

Output: 16
A┌┐^
└┘└┘

Output: 7.5
#B┐
|\v
A<#

Output: 11.4
(Note: First the head cuts bottom-left triangle, then moves its head to the beginning of top-right triangle cut. 45 degree corners take continuations first instead of new cuts.)
A-@<--┐
^  \  |
└--B@-┘

Output: 21.15
A-┐ ┌--┐ ┌-┐ ┌--┐ C-┐ ┌--┐ ┌-┐ ┌--┐
^ | |  | | | |  | ^ | |  | | | |  |
└-+-+--┘ └-+-+--┘ └-+-+--┘ └-+-+--┘
  | |      B |      | |      D |
  └-┘      ^-┘      └-┘      ^-┘

Output: 138.41
 #-#
A X
 X \
@ @-#
v

Output: 13.5
A> F> K> P> U> a>
B> G> L> Q> V> b>
C> H> M> R> W> c>
D> I> N> S> Y> d>
E> J> O> T> Z> e┐
<---------------┘

Output: 104.29
\$^1\$ If needed, replace this with a set of your choice.

Can we use swap the 4 90 degree cut symbols for ASCII symbols (e.g. use 1,2,3,4) instead?

You should explain what you mean by "next to a diagonal cut". I thought it'd mean adjacent to # or @ (since 45° and 135° lines are diagonals), but this doesn't fit with the test cases.

The output is defined as the distance that the head moves, but there's almost
no explanation of how the head moves. Each character is associated with a
"value"; are those actually distances? "The head moves from the end of the
first cut to the beginning of the second cut in a straight line"; is that
specific to the first cut, or true for all pairs of consecutive cuts?


text:
Tips for golfing javascript code, especially converting while loop to expression
The code:
function L(){N=null;E=[N,N];t=this;h=E;t.u=i=>h=[i,h];
t.o=_=>h==E?N:h[+!(h=h[1])];t.e=(i,l)=>h=(l||h)==E?[i,
E]:[(l||h)[0],t.e(i,(l||h)[1])];t.s=_=>{o="";while(i=t.o())
{o+=i+","}return o}}

For my response to this (old) question: https://codegolf.stackexchange.com/a/196783/72421 (my linked answer has a commented version of the code and some disclaimers about valid inputs and outputs)
I'm looking for suggestions on how to golf it further. I feel the last function is especially verbose. I managed to make every other function a single expression so I didn't need curly brackets or a return statement, but couldn't figure out how to make the last one not require a while loop.

As a side note, I think t.o() fails if the list contains a 0 (or any other falsy value that may actually appear in the list), because it's treated the same way as a null. I assume that you're only asking for a golfed version, bugs included. :) But you may want to clarify this point.

@Arnauld I mentioned that as a disclaimer on my answer. I'm new, and not sure if that's a violation of the rules. Also wasn't sure if I should copy-paste all that into this question.

Oh I see. I overlooked the footnote in your answer.

@Arnauld If someone figured out a better way to do t.o that didn't have that issue (without just replacing +!. with an equality test that adds a few bytes) I'd definitely consider that a valid answer to this question.

I think the best way to get rid of the curly brackets is to go recursive.
Original function (46 bytes)
t.s=_=>{o="";while(i=t.o()){o+=i+","}return o}

Recursive version (29 bytes)
t.s=_=>(i=t.o())?i+[,t.s()]:i

The i+[,t.s()] trick saves a byte over i+','+t.s().
Because you stop when t.o() returns null, the result of your original version always ends with a comma. In the new version, we actually append null at the end (that's the :i) but it's coerced to an empty string because of the above trick, leading to the same behavior.

Thank you! Do you have any suggestions for avoiding h being a global variable without having to replace every usage with t.h?

@DanielFranklin You can simply declare function L(h) (an unused parameter) to put h in the local scope. But this is code-golf, so we usually don't worry about that -- unless explicitly specified otherwise but I haven't read the original challenge thoroughly.

Thank you. Good to know that isn't necessary.

Shortening t.s
Favor recursion over while loop
Given your t.s function
t.s=_=>{o="";while(i=t.o()){o+=i+","}return o}

Observe that o is a simple accumulator, so we can easily convert the loop into a recursive function. There are several ways to write the recursive function:
// explicit accumulator, aka tail-recursion
t.s=(o="")=>(i=t.o())?t.s(o+i+","):o
// implicit accumulator, shorter, saves 15 bytes from OP's code
t.s=_=>(i=t.o())?i+","+t.s():""

Free commas
i+","+t.s() can be shortened to i+[,t.s()], saving 1 byte.
Shortening the rest
Initialize the second parameter of t.e to h
The function t.e is using (l||h) several times, just to handle the initial call. JS's default argument is very permissive, so we can do this:
// instead of
t.e=(i,l)=>h=(l||h)==E?[i,E]:[(l||h)[0],t.e(i,(l||h)[1])];
// do this
t.e=(i,l=h)=>h=l==E?[i,E]:[l[0],t.e(i,l[1])];

Simplify base case
Instead of E=[N,N], simply E=[] works too. This has several golfing opportunities regarding string coercion:

h==E is equivalent to h==[], and [] coerces to "". Anything that stringifies into something other than "" is greater than E, so we can rewrite h==E?A:B into h>E?B:A.
h is now a linked list where 3::2::1::nil looks like [3,[2,[1,[]]]], which exactly stringifies into "3,2,1,". So we can simply coerce h to string: t.s=_=>h+"", or even better, t.s=_=>h+E.

Array unpacking
We can slightly do better here too:
// instead of
t.o=_=>h>E?h[+!(h=h[1])]:N;
// do this
t.o=_=>h>E?([a,h]=h,a):N;

And this also applies to t.e:
// instead of this
t.e=(i,l=h)=>h=l>E?[l[0],t.e(i,l[1])]:[i,E];
// do this
t.e=(i,[a,l]=h)=>h=l?[a,t.e(i,l)]:[i,E];

I chose l? because whenever h is nonempty, l is a reference so it always evaluates to true. If h is empty, both a and l become undefined.
Side note: I found that the OP's code actually works with falsy list items, because the only real comparison is h==E, that is, comparing stringification reference of whole array. Whatever E is, h==E cannot be true if the list h has at least one item, since its string will have at least one more comma than E's the reference becomes different.
Final result, 125 121 bytes
function L(){h=E=[];t=this;t.u=i=>h=[i,h];t.o=_=>h>E?([a,h]=h,a):null;t.e=(i,[a,l]=h)=>h=l?[a,t.e(i,l)]:[i,E];t.s=_=>h+E}

Try it online!

Side side note: JavaScript compares arrays by reference, not by string. You're still right I think. You can verify this from the fact that [1,1]==[1,1] is false but [1,1]+""==[1,1]+"" is true

*compares two arrays

why not L=()=>{ * insert L's body here * }

@famous1622 Because I have to provide a class, and you can't use new to create an instance of an arrow function. Furthermore, this in the arrow function would refer to window because arrow functions don't have their own scope