Long year: Difference between revisions

m (syntax highlighting fixup automation)
Line 2,149:
<pre>
long years 2000-2099: 2004 2009 2015 2020 2026 2032 2037 2043 2048 2054 2060 2065 2071 2076 2082 2088 2093 2099
</pre>
 
=={{header|RPL}}==
This is a direct transcription from [https://en.wikipedia.org/wiki/ISO%20week%20date Wikipedia's formula].
{{works with|Halcyon Calc|4.2.7}}
{| class="wikitable"
! Code
! Comments
|-
|
DUP 1 -
1 2 '''START'''
→ y ≪ y DUP 4 / IP + y 100 / IP - y 400 / IP + 7 MOD ≫
SWAP
'''NEXT'''
3 == SWAP 4 == OR
≫ 'LONG?' STO
|
( year -- weekday )
Calling 2 times...
... p() as a nested function, to get p(y-1)...
...then p(y)
|}
The following line of code delivers what is required:
≪ {} 2023 2100 '''FOR''' y '''IF''' y LONG? '''THEN''' y + '''END NEXT''' ≫ EVAL
{{out}}
<pre>
1: { 2026 2032 2037 2043 2048 2054 2060 2065 2071 2076 2082 2088 2093 2099 }
</pre>
 
1,150

edits