Undulating numbers: Difference between revisions
Content added Content deleted
(J draft (hopefully these expressions are sufficient labels for their results)) |
m (→{{header|J}}: presort undul numbers - this could be made more efficient by sorting when the base is chosen) |
||
Line 233: | Line 233: | ||
So, given: |
So, given: |
||
<syntaxhighlight lang=J>require'stats' |
<syntaxhighlight lang=J>require'stats' |
||
undul=: {{ m #. y$"1 |
undul=: {{ /:~ m #. y$"1(<:m)}.(,|."1)2 comb m }} |
||
und10=: 10 undul |
und10=: 10 undul |
||
und7=: 7 undul |
und7=: 7 undul |
||
fmt7=: 7{{' '-.~":m&#.inv y}}</syntaxhighlight> |
fmt7=: 7{{' '-.~":m&#.inv y}}</syntaxhighlight> |
||
We get: |
|||
<syntaxhighlight lang=J> 9 9$und10 3 |
<syntaxhighlight lang=J> 9 9$und10 3 |
||
121 131 141 151 161 171 181 191 |
101 121 131 141 151 161 171 181 191 |
||
242 252 262 272 282 292 |
202 212 232 242 252 262 272 282 292 |
||
303 313 323 343 353 363 373 383 393 |
|||
404 414 424 434 454 464 474 484 494 |
|||
505 515 525 535 545 565 575 585 595 |
|||
606 616 626 636 646 656 676 686 696 |
|||
707 717 727 737 747 757 767 787 797 |
|||
808 818 828 838 848 858 868 878 898 |
|||
909 919 929 939 949 959 969 979 989 |
|||
9 9$und10 4 |
9 9$und10 4 |
||
1212 1313 1414 1515 1616 1717 1818 1919 |
1010 1212 1313 1414 1515 1616 1717 1818 1919 |
||
2424 2525 2626 2727 2828 2929 |
2020 2121 2323 2424 2525 2626 2727 2828 2929 |
||
3030 3131 3232 3434 3535 3636 3737 3838 3939 |
|||
4040 4141 4242 4343 4545 4646 4747 4848 4949 |
|||
5757 5858 5959 6767 6868 6969 7878 7979 8989 |
|||
5050 5151 5252 5353 5454 5656 5757 5858 5959 |
|||
1010 2020 3030 4040 5050 6060 7070 8080 9090 |
|||
6060 6161 6262 6363 6464 6565 6767 6868 6969 |
|||
2121 3131 4141 5151 6161 7171 8181 9191 3232 |
|||
7070 7171 7272 7373 7474 7575 7676 7878 7979 |
|||
8080 8181 8282 8383 8484 8585 8686 8787 8989 |
|||
7373 8383 9393 5454 6464 7474 8484 9494 6565 |
|||
9090 9191 9292 9393 9494 9595 9696 9797 9898 |
|||
(#~ 1 p:])und10 3 |
(#~ 1 p:])und10 3 |
||
131 151 181 191 353 373 383 787 797 |
101 131 151 181 191 313 353 373 383 727 757 787 797 919 929 |
||
(<:600){ |
(<:600){;und10&.>3+i.>.600%81 |
||
4646464646 |
4646464646 |
||
(#,{:) |
(#,{:)(#~ (2^53)>:]);und10&.>3+i.>.10^.2^53 |
||
1125 8989898989898989 |
1125 8989898989898989 |
||
6 7$ und7 3 |
6 7$ und7 3 |
||
64 71 78 85 92 |
50 64 71 78 85 92 100 |
||
107 121 128 135 142 150 157 |
|||
164 178 185 192 200 207 214 |
|||
221 235 242 250 257 264 271 |
|||
278 292 300 307 314 321 328 |
|||
335 64 71 78 85 92 |
335 50 64 71 78 85 92 |
||
6 7$ und7 4 |
6 7$ und7 4 |
||
450 500 550 600 650 |
350 450 500 550 600 650 700 |
||
750 850 900 950 1000 1050 1100 |
|||
950 1000 1250 1300 1350 1650 1700 |
|||
1150 1250 1300 1350 1400 1450 1500 |
|||
1550 1650 1700 1750 1800 1850 1900 |
|||
750 1100 1450 1800 2150 1150 1500 |
|||
1950 2050 2100 2150 2200 2250 2300 |
|||
2350 450 500 550 600 650 |
2350 350 450 500 550 600 650 |
||
(#~ 1 p:])und7 3 |
(#~ 1 p:])und7 3 |
||
71 107 157 257 |
71 107 157 257 271 307 |
||
fmt7(<:600){ |
fmt7(<:600){;und7&.>3+i.>.600%36 |
||
4646464646464646464 |
4646464646464646464 |
||
(#,&":' ',fmt7@{:) |
(#,&":' ',fmt7@{:)(#~ (2^53)>:]);und7&.>3+i.>.7^.2^53 |
||
603 5252525252525252525</syntaxhighlight> |
603 5252525252525252525</syntaxhighlight> |
||