« first day (1371 days earlier)      last day (38 days later) » 

2:27 AM
Looking at keysPressed(⊣⌷⍨((⊣⍳(⌈/))(2-⍨/⊢)))releaseTimes
Are there redundant parenthesis here?
https://leetcode.com/contest/weekly-contest-212/problems/slowest-key/
Oh. Max doesn't need its parenthesis.
 
2:57 AM
Oh. wrong answer there... :|
 
I can't see the leetcode question, it has a login prompt; maybe you could use grade to find the largest instead of max-reduce-iota?
some variation on 'abcde'[1+⊃(⍋2-/⊢)1 3 5 8 9]
like one without parens and right tack 'abcde'[⊃⍋2-/1 3 5 8 9]
 
 
4 hours later…
6:50 AM
yesterday, by Adám
@code_report {⍵⌷⍨⊃⍒⍵,⍨⍪2-⍨/0,⍺}
 
 
1 hour later…
8:16 AM
@TessellatingHeckler simplified failing example - ≢⟨⟩⥊⟨1,2⟩
 
8:29 AM
@dzaima I think it was coming from the $() in case 10,19, and I rewrote it, which changed that one but doesn't change this one
@dzaima what should this do, an empty list reshape?
 
@TessellatingHeckler actually, it doesn't do what i meant it to, but it doesn't really matter here - all i was trying to get was getting the shape of a scalar
this is what i wanted to do - ≢⟨⟩⥊⟨⟨1,2⟩⟩; but it should act the same way
 
ok that is in the code for reshape where it also has a $() with an "if" inside it, and it returns $w instead of ,$w
 &$arr ($x[0..($x.Count-1)]) $(if($null-ne$w){,$w}else{,@($x.Length)})}
$() is also in divide and minus, presumably their arguments can only be scalar integers, and lesseq where the return value is only going to be 0 or 1 not an array
 
@TessellatingHeckler right, that's true
@TessellatingHeckler and with that runtime seems to finish executing..?
 
oh yeah i also make call's last line be return ,(&$f $x $w);
 
8:42 AM
I tried that on $call and removed it a couple of times; it does seem to finish, and returns ... a single function?
 
@TessellatingHeckler seems to return a list of functions for me (with the different runtime)
end of execution:
https://dzaima.github.io/paste/#07VdNb9owGL7zK94yi9ptgghpaGmaql0PO2yadq96iFIHrLlJZ4cCQvnve52Ej9ANrSvbUIeFhGP7@bKxcR7PwXWcjg9ROkoyrsBx3ZOeDyLRmTqHruODzsLoa9l/Dp7XeCwgbh1yugHSqyCndcjZAtJZR5xWiH4d0d8gclZCunVfXmcDpF9BenWI83NIr1NB6sa87gaIU0LcNWPuAuKuI7oVwqsjTpYi3hoENUIVPlAysciYQYtEQK8oUVbZcEye2G6OEDElyUhKO@H4OENAKCWQAZAJkHHOpeaLxrhq/Bc@yShYtRqzZ64KqyTOfaDLFIvqsBxliLY@A3uGPcOuMfyNnf@/uNwz7Bn2DG@VYaxExu1hqjNoHnhmiG3jqCbYcao4RFMfCoWgRUKtucqAOjb/RiaLkypmAOamkUB5lMX4yN5276w2hb9R3oHkGegoTCCAB4fGEFwCnVjIhpVZA2rrYsYtFwQ7iR4GZNLWQ399begBeZiK5CmNwkykSfs9XtDvvxi3HO/xun2TJlmI1/iPfEoPx4eM2W
@dzaima note the reduction of the stack size from 62 to 1 at the end - making a 62-item list
 
going to recompile the original new runtime and retry
@dzaima that's a lot more than I get from it
@dzaima dzaima.github.io/… using the runtime from ./cjs.bqn r
@dzaima could you paste your code so I can diff, please?
 
8:58 AM
@TessellatingHeckler with a fresh properly compiled runtime (at whatever commit i'm at): gist.github.com/dzaima/df3832a8bd87ad56093e9e64576a557a
 
@dzaima they seem very similar, and if I copy your bytecode in, I get a ton of functions out
 
changing $qq to $runtime and seeing if the compiler builds (nope)
 
Is that PHP?
 
@TessellatingHeckler so something's wrong with your runtime version. i think my new one is fine
@Azmuth nothing here is PHP
 
9:08 AM
Then what?
 
@Azmuth It's PowerShell, I've been trying to port Marshall's BQN interpreter in JavaScript into it
 
Oh okay!
So people only talk about Powershell here?
 
(as a stepping stone on the way to C#, maybe, although this was beyond me without help)
 
@Azmuth no, this is primarily an APL room, this is a powershell implementation of a language descended from APL
 
@Azmuth Gosh no, I'm the only one who is dragging that in. Here is for APL and array languages and array related discussions
and BQN is one of those languages
 
9:18 AM
@Azmuth Do you know about APL?
 
9:42 AM
crickets chirping
 
> There’s one thing that comes through in a lot of this history, by the way: notation, like ordinary language, is a dramatic divider of people. I mean, there’s somehow a big division between those who read a particular notation and those who don’t. It ends up seeming rather mystical. Stephen Wolfram
 
 
1 hour later…
11:03 AM
@Marshall i suppose getting the compiler to map the tokens to the corresponding bytecode is the complicated part
 
 
1 hour later…
12:05 PM
           ]PERFORMANCE.spaceneeded '⍴{⍵⌿⍨0{0=(pco 1+⍺)|10⊥3↑⍺↓⍵}⍤1⊢⍵}p'
┌──────────────────────────────────┬─────────┐
│⍴{⍵⌿⍨0{0=(pco 1+⍺)|10⊥3↑⍺↓⍵}⍤1⊢⍵}p│224598316│
└──────────────────────────────────┴─────────┘
      ⎕WA
224671712
      ⍴{⍵⌿⍨0{0=(pco 1+⍺)|10⊥3↑⍺↓⍵}⍤1⊢⍵}p
WS FULL
How come this happens? It seems like I have just enough space
 
@rak1507 Could it be that you have ⎕FR←1287 in # while the user command runs in ⎕SE with ⎕FR←645?
 
Nope, ⎕FR is 645
Maybe something to do with ⎕CY 'dfns'
 
(I'd think the user command executes the expression where you called it from, so this shouldn't be the case and this was just a wild guess.)
 
Yeah
 
I'm surprised that the ucmd even succeeds if the expression it runs fails. The ucmd system has quite some overhead.
@rak1507 Ah, who says it does succeed? I don't know how it reacts if the expression gives a WS FULL from the outset. Try ]spaceneeded '⍴#.res←{⍵⌿⍨0{0=(pco 1+⍺)|10⊥3↑⍺↓⍵}⍤1⊢⍵}p'
 
12:12 PM
Oh that's probably true, it's probably erroring
      ≢⍳1E10
WS FULL
      ≢⍳10000000000
       ∧
      ]PERFORMANCE.spaceneeded '≢⍳10000000000'
┌─────────────┬─────────┐
│≢⍳10000000000│224598660│
└─────────────┴─────────┘
Yep
 
The way it works is quite silly; it simply fills the memory until the expression fails. Clearly, it doesn't start with a sanity check.
 
It would be nice if the command showed that it failed, but I guess it makes sense
 
Nah, I think it itself should WS FULL.
 
Yeah I agree
 
@rak1507 Can you try using wsreq from dfns.dws? It looks like it has been updated. If that works better, then I'll merge from dfns.dws to the ucmd.
 
12:18 PM
       wsreq '⍴{⍵⌿⍨0{0=(pco 1+⍺)|10⊥3↑⍺↓⍵}⍤1⊢⍵}p'
224668592
Seems like it does the same thing
 
@dzaima I think it should be pretty easy, actually. The token stream is only reordered twice, once to reverse expressions and once by bracket/strand depth. Output bytes are ordered by indices in the stream after the first reversal, so to get the source indices I just need to use those indices and the expression-reversing permutation. If I'm right about that, the only difficult part is getting the output right for instructions like function application that don't correspond to a single token.
 
@rak1507 OK, I think I have a fix. Wanna try it?
 
Sure, maybe later though, I'm in class right now and shouldn't be APLing anyway
 
@rak1507 Just posting it here for later:
]uload spaceneeded
)ed Monitor.wsreq
_←##.THIS⍎⍵ ⍝ insert this line at the very top of the function, right after "wsreq←{"
 
 
3 hours later…
RGS
3:23 PM
So I have been using APL for a couple of months now, and in the beginning I had this struggle to keep the whitespace I wanted, say, around ←
And I can't really tell why, but in the past few months it just has been working.
But now I'm running into this issue again, and it may or may not be related to using Link to keep # synced with a folder.
What was the incantation one could use to open the editor and kind of force it to save your whitespace? I thought it was smth like ⎕ED 2⎕FIX ,⊂,'funcname' but it doesn't look like this works.
 
ngn
@RGS + ← 1. i'm still struggling with keeping any unnecessary whitespace :)
 
RGS
@ngn XD
@ngn I swear I have been using less whitespace in APL programs! But there's some things I don't want to give up on...
re: my message above, turns out I'm writing the correct thing, except for some reason it doesn't work with link
 
4:25 PM
@RGS If you use Link, then you can (but don't have to) keep your source as typed without any incantations.
 
RGS
I want to keep the source as I typed it without incantations.
I just can't figure out how to do it.
Hm, I am assuming I can define things straight from within the Windows interpreter.
 
4:46 PM
How come even if I do ⎕PP←34 {⍵,⊃⌽2+/⍵}⍣90⊢0 1 is inexact?
 
@RGS Let's look at it tomorrow.
@rak1507 ⎕PP only sets print precision, not representational precision. Try ⎕FR←1287
 
Done that as well
 
RGS
@Adám Wdym? Is it complicated to have the interpreter respect my whitespace formatting?
 
@RGS Yes :-(
 
RGS
Ah ok, then that is (sad but) as good an answer as anything else. It is for the screencasts, so if it is complicated, I won't do it.
 
5:21 PM
@RGS Oh, no, it isn't complicated from the user's perspective, only from the interpreter implementers' perspective.
@rak1507 So, what exactly is the problem?
 
Oh it doesn't matter now, thanks though
 
5:40 PM
Dfns.memo is painfully slow, I have managed to get around it by basically doing
s ← {f ⍵}¨⍳100
s ← {⍵<100: s[⍵] ⋄ f ⍵}¨⍳1000
s ← {⍵<1000: s[⍵] ⋄ f ⍵}¨⍳10000
...
but is there a smarter way?
 
Volunteers wanted: We're getting ready for the 2021 APL Problem Solving Competition, and are seeking volunteers to review and solve the candidate problems, and test the website. Please ping me if you're interested ― you don't have to be an APL wizard. (Of course, this disqualifies you from winning.)
@rak1507 Now I'm wondering why it is so slow. It is quite simple. Of course, the first time for each unique argument will be slow.
 
Trying to time it with ]runtime -c just killed it, and I have to eat dinner, so I'll look again in a bit
 
6:06 PM
@dzaima (and anyone interested) Considering an extension to Join, allowing some axes in the argument elements to be omitted. Currently the arrays in a slice (obtained by selecting one position from the outer array on one axis) have one axis in common, corresponding to the selection axis of the slice. The idea is to allow this to be reduced to zero axes, as long as some slice along this dimension still has one axis.
 
RGS
Does the APL interpreter optimize f¨g¨Y to f∘g¨Y?
 
@RGS That's usually not an optimization.
 
RGS
Maybe the choice of words was terrible
What I mean is : does the interpreter realise it can do a single "loop" instead of two loops in a row?
@Marshall Or do you mean they may not be equivalent?
 
@RGS No, it cannot:
      f←{⍞←'f'} ⋄ g←{⍞←'g'} ⋄ f¨g¨⍳3 ⋄ ⍬⊤⍬ ⋄ f∘g¨⍳3
gggfff
gfgfgf
 
RGS
What if f and g are simple primitives?
 
6:10 PM
Damn side effects!
 
@RGS Like ??
 
RGS
      vm ← 1000⍴⊂?100 1000⍴100
      ]runtime -c "⍴¨ ⍉¨ vm" "⍴∘⍉¨ vm"

  ⍴¨ ⍉¨ vm → 5.5E¯2 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ⍴∘⍉¨ vm  → 5.5E¯2 | -1% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
I guess ≢¨⍴¨ could be optimised to ≢∘⍴¨
 
That whole -1% improvement makes it totally worth checking if the functions have side effects in advance
 
RGS
I thought the second one would be clearly faster, but turns out it isn't.
 
6:12 PM
@Marshall The obvious question is how to disentangle these axes when they don't all have the same position, and it turns out to be only slightly more difficult. An array with all axes will necessarily have the highest rank among elements, or be tied for it. Some slice along each dimension has an axis, so from the intersection, there's at least one such array. From that array we can move along each axis separately to pick out the other axes.
 
@RGS I don't think you can actually save any computation time, only memory usage.
 
2 loops vs 1?
 
The applied functions have to be very light if the loop is to matter.
 
@Marshall An array separated in only one dimension will differ only in the corresponding axis, so if it has lower rank than the maximum-rank array, its axis in that dimension is empty, and otherwise, it has every axis and analysis works exactly as it does now.
 
RGS
@Adám Yeah I understand
 
6:15 PM
@Marshall A practical example?
      a←1000⍴⊂⎕A
      ]runtime -c ⊃¨⌽¨a ⊃∘⌽¨a {⊃⌽⍵}¨a
  ⊃¨⌽¨a   → 1.1E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ⊃∘⌽¨a   → 1.5E¯4 | +40% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⊃⌽⍵}¨a → 8.9E¯5 | -16% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
      ]spaceneeded ⊃¨⌽¨a ⊃∘⌽¨a {⊃⌽⍵}¨a
 ⊃¨⌽¨a    111620
 ⊃∘⌽¨a     40476
 {⊃⌽⍵}¨a   40492
 
@Adám You can pad the edges of a matrix by placing lists to its sides, and units at the corners. For a simpler example, you could add a column vector to a matrix with ∾≍⟨mat,vec⟩, which is the same as mat∾˘vec.
And as the simplest example, Join would work on a list containing lists and units, instead of requiring them all to be lists like it does now.
 
 
1 hour later…
7:44 PM
Can you not use statement separators using ]runtime -c ?
 
@rak1507 No, I think you have to wrap in a dfn, or simply use (unless you're assigning a function).
 
Ah
g ← f memo (cache ⍬)
          ]runtime -c  '{⍵<1000:s[⍵] ⋄ f ⍵}¨⍳10000 ⊣ s←{⍵<100:s[⍵] ⋄ f ⍵}¨⍳1000 ⊣ s←f¨⍳100' 'f¨⍳10000' 'g¨⍳10000'

      {⍵<1000:s[⍵] ⋄ f ⍵}¨⍳10000 ⊣ s←{⍵<100:s[⍵] ⋄ f ⍵}¨⍳1000 ⊣ s←f¨⍳100 → 3.2E¯1 |    0% ⎕⎕⎕⎕⎕
      f¨⍳10000                                                           → 3.2E¯1 |   -3% ⎕⎕⎕⎕⎕
      g¨⍳10000                                                           → 2.7E0  | +733% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
(Trust me, the first method gets a lot faster for bigger values)
 
This looks all kinds of wrong. Can you try a thing?
 
Sure
 
c←cache ⍬
g←f memo c
…
 
8:00 PM
c←cache ⍬
      g ← f memo c
      ]runtime -c  '{⍵<1000:s[⍵] ⋄ f ⍵}¨⍳10000 ⊣ s←{⍵<100:s[⍵] ⋄ f ⍵}¨⍳1000 ⊣ s←f¨⍳100' 'f¨⍳10000' 'g¨⍳10000'

  {⍵<1000:s[⍵] ⋄ f ⍵}¨⍳10000 ⊣ s←{⍵<100:s[⍵] ⋄ f ⍵}¨⍳1000 ⊣ s←f¨⍳100 → 3.7E¯1 |    0% ⎕⎕⎕⎕
  f¨⍳10000                                                           → 3.2E¯1 |  -14% ⎕⎕⎕
  g¨⍳10000                                                           → 3.7E0  | +901% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕




      ⎕⎕⎕⎕
I'm not sure what you were trying to achieve... but I assume this was not it
Weird
I'll do a test on 100K
 
What is f?
 
{⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}
Maybe the recursion has something to do with it?
I could do it non recursively easily enough
 
It should never get there.
 
Wdym
 
The memoisation should never go to the recursion unless it is a new value. I suspect the namespace access is at fault.
 
8:13 PM
Oops, I just did something and interrupting doesn't seem to work, is there some sort of 'kill everything immediately' shortcut
 
OS?
 
Windows
 
systray→icon→Strong interrupt
 
Infinite recursion (forgot base cases) + debug print statements = chaos
 
@rak1507 You should be able to do Ctrl+Break or Threads→Show Threads, then double-click on the offending thread.
 
8:21 PM
Thanks, that'll be useful
 
@rak1507 Maybe write your own simple memo impl. by just looking in global vars.
 
Oh, I had 10+⍳≢⍵ instead of (≢⍵)+⍳10, so I was applying my function to 0, which recurses to 0.... etc
 
8:34 PM
{⍵,(⍵{⍵∊1 89:⍵ ⋄ ⍵<⍵⍵:⍺⍺[⍵] ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}(≢⍵))¨(≢⍵)+⍳1000}⍣1000⊢⍬
Any tips on speeding this up?
 
Custom memoisation:
      f←{⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}
      _Memo←{⍵∊k:v⊃⍨k⍳⍵ ⋄ k,←⍵ ⋄ v,←⍺⍺ ⍵}
      ]runtime -c f¨⍳10000 "f _Memo¨⍳10000⊣k←v←⍬"

  f¨⍳10000             → 6.2E¯1 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  f _Memo¨⍳10000⊣k←v←⍬ → 3.9E¯2 | -94% ⎕⎕⎕
Ah, yes, it is the namespace access that is super slow.
 
for 1 million that hasn't even finished on my laptop yet
 
@rak1507 Which one hasn't?
 
Your memoisation
It just finished, doing a runtime -c with my old one to compare
 
But mine doesn't do a partial building of the cache first. I think I can improve on it.
 
8:49 PM
      ]runtime -c '{⍵,(⍵{⍵∊1 89:⍵ ⋄ ⍵<⍵⍵:⍺⍺[⍵] ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}(≢⍵))¨(≢⍵)+⍳500}⍣2000⊢⍬' 'f _Memo¨⍳1000000⊣k←v←⍬'

  {⍵,(⍵{⍵∊1 89:⍵ ⋄ ⍵<⍵⍵:⍺⍺[⍵] ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}(≢⍵))¨(≢⍵)+⍳500}⍣2000⊢⍬ → 6.7E0  |     0% ⎕⎕
  f _Memo¨⍳1000000⊣k←v←⍬                                               → 1.5E2  | +2120% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕



      ⎕⎕⎕⎕⎕⎕⎕
 
@rak1507 Oh, ok, with inside memo, an outer memo cannot compete.
 
Ah, makes sense
 
@rak1507 Here is an inside version of the above: fMemo←{⍵∊k:v⊃⍨k⍳⍵ ⋄ k,←⍵ ⋄ ⍵∊1 89:v,←⍵ ⋄ v,←∇+/2*⍨10⊥⍣¯1⊢⍵}
 
9:21 PM
It's not even that much faster in my (incredibly naive) C++ solution
Somehow I bet ngn has a k solution that runs in 0.1 ms
 
@ngn ^
 
Well, with a brief look at the problem thread, most people seem to have a python solution taking around 2 minutes (my python solution only takes a few seconds), but one person seems to have some sort of crazy solution that takes under a second
 
RGS
rak, what are you trying to do/solve?
 
ngn
too much chat history to read
@rak1507 you know where to find it :)
 
RGS
9:30 PM
@rak1507 That is a really interesting problem! ty for sharing
 
@rak1507 Not faster, but shorter/simpler: {⍺,⍺{⍵∊1 89:⍵ ⋄ ⍵<⍵⍵:⍺⍺[⍵] ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}⍵¨⍵+⍳l}∘≢⍨⍣l⊢⍬
 
RGS
Problem 92 v2.0 : prove that every number eventually ends up at 89 or 1
 
@RGS np
 
RGS
It is actually fairly easy to prove so, now that I think of it. Although the proof I'm envisioning is not very elegant.
@rak1507 What are your thoughts?
 
For the proof?
 
RGS
9:32 PM
Yes
 
no idea
 
RGS
Ah ok :P
Well, I am 99.99% sure you know enough maths to prove it.
 
Probably, I guess one way would be assuming that's false, and then proving that there aren't any other loops? Not sure
 
RGS
@rak1507 Proving there are no other loops doesn't prove all numbers go to 1 or 89. You would have to prove there are no other loops AND that all numbers fall into a loop.
 
Past a certain point, the sum of squares of n has to be <n, so there can't be a sequence that grows infinitely, and there can't be one that shrinks infinitely, therefore all numbers must end up in a loop at some point, and if there are no other loops, they must end up either in a loop with 1 or 89.... maybe
 
RGS
9:38 PM
Ah nice. Yeah, that is almost it :P You just have to prove that "the sum of squares of n has to be <n" for some n and show that all others go to 1 or 89, for example by explicitly showing the sequences of ALL numbers below that n :P
 
Something something insert maths here QED
 
RGS
√ well done
 
What is the square root of well done?
 
RGS
⋄ √ well done
 
@RGS Illegal code
 
RGS
9:42 PM
@Adám there you have it, Illegal code it seems.
 
Then the square of Illegal code should be well done…
⋄ Illegal←{⍵ ⋄ ⍺⍺}
code←'well done'
2*⍨Illegal code
 
@Adám well done
 
Yup, that's right.
 
RGS
See? Everything adds up :D
Erm, multiplies up
 
This is a very clever approach
It is probably portable to APL (maybe)
 
RGS
9:52 PM
It is definitely portable to APL
I love that solution, it is really clever.
 
@rak1507 "What is most amazing is that EVERY starting number will eventually arrive at 1 or 89. How many starting numbers below ten million will arrive at 89?"
all of them? you just said that
 
Either 1 or 89, not both
 
oh now I see that
:grimace:
 
RGS
ahahah
 
1^2 = 1, 1^2 = 1, 1^2 = 1 .... = 89?
lol
 
10:03 PM
+/89={+/2*⍨10⊥⍣¯1⊢⍵}⍣{⍺∊1 89}¨ 1+⍳1e4 and just increase the last number a few orders of magnitude >_>
at ~5 seconds to 100k, estimate 50 seconds to 1M, 500 seconds to 10M that's <10 minutes
 
Haha, have fun waiting until the heat death of the universe
 
@rak1507 in parallel, it would only take 1/Nth the time until then
      +/89={+/2*⍨10⊥⍣¯1⊢⍵}⍣{⍺∊1 89}IÏ 1+⍳1e5
ISOLATE ERROR: All processes are in use
hm, presumably it's not Erlang and doesn't like 1e5 parallel threads
 
lol
+/89={⍵,(⍵{⍵∊1 89:⍵ ⋄ ⍵<⍵⍵:⍺⍺[⍵] ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}(≢⍵))¨(≢⍵)+⍳1000}⍣10000⊢⍬ takes 104 seconds apparently, I swear my old solution ran on TIO but it doesn't any more
s ← {⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳100
s ← {⍵<100: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳1000
s ← {⍵<1000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳10000
s ← {⍵<10000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳100000
s ← {⍵<100000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳500000
s ← {⍵<500000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳1000000
s ← {⍵<1000000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳2000000
s ← {⍵<2000000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳3000000
s ← {⍵<3000000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳4000000
s ← {⍵<4000000: s[⍵] ⋄ ⍵∊1 89:⍵ ⋄ ∇+/2*⍨10⊥⍣¯1⊢⍵}¨⍳5000000
I mean, it's horrible, but it's not too slow
 
10:23 PM
> You just have to prove that "the sum of squares of n has to be <n" for some n
every extra digit increases the max value of number N by ten times, the max square of a digit is 9×9=81, so one value grows as 10^digits and the other 81×digits
      10∘*¨⍳10
┌→───────────────────────────────────────────────────────────────┐
│1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000│
└~───────────────────────────────────────────────────────────────┘
      81∘ר1+⍳10
┌→─────────────────────────────────────┐
│81 162 243 324 405 486 567 648 729 810│
└~─────────────────────────────────────┘
so, sum of squares of digits of n < n by at most 1000; Is that enough to count as proof?
 
@TessellatingHeckler Yes.
 
Might give implementing (and more importantly, understanding) the fast version during computer science tomorrow, but for now it is beyond me, bye all ∘/
 
○/
 
RGS
11:11 PM
@TessellatingHeckler Yes
I would have written that a number of k digits has said sum be at most 81×k, while a number of k digits is at most ¯1+10*k. The second term outgrows the first one very early. E.g. with k ← 3 it already has
 

« first day (1371 days earlier)      last day (38 days later) »