| Ruud H.G. van Tol on Sat, 14 Oct 2023 19:24:40 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| digits(n,-4) |
? fromdigits( [1,3,0], -4 ) % 4 ? my(n=4, v=[]); while( n=divrem(n,-4), v=concat(n[2],v); n=n[1] ); v % [1, 3, 0] Is there a better way to do this? Should digits() be changed to support a negative base? -- Ruud