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]
- To: pari-users <pari-users@pari.math.u-bordeaux.fr>
- Subject: digits(n,-4)
- From: "Ruud H.G. van Tol" <rvtol@freedom.nl>
- Date: Sat, 14 Oct 2023 19:24:35 +0200
- Arc-authentication-results: i=1; smtp.freedom.nl; auth=pass smtp.mailfrom=rvtol@freedom.nl
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freedom.nl; s=default; t=1697304275; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=YuzGUR2S0OTWn0CtG/iE0SQRy3rBP7imQpVtpXm5N14=; b=DQPrLIMpH1tn4XEyJi9bC5ySW0AN5wLvtgjSFv+kqxjKKxnuLfR0DzBEYbQuKn3onPOGMN uFFqeGFFFEh9Uat1MSfn0hAP3h8jwYET+cbw0pU8Q5WB4ejlkaUx5Q8FRuF4nOJ6gt8Zu6 fzl0Vt5RKaZ47UmtWWSwFYSI22Gc0a0=
- Arc-seal: i=1; s=default; d=freedom.nl; t=1697304275; a=rsa-sha256; cv=none; b=usWOHE/PNvCW1TPEqG3861zgB0TFZIkyd+EKPgy3zo24n29qmh0u1xvnHzkh8Jn5Cw7RoG VOrDJf072oQfiTR7yzviCM18Kp4TGPzw8GbG7Q9JHNbgY7jtl/HBdBRMdEoBC2uacxsWVy nTgj5OLZuRbnss2LPSkod1wQN8Md0mU=
- Delivery-date: Sat, 14 Oct 2023 19:24:41 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=freedom.nl; s=default; t=1697304275; bh=YuzGUR2S0OTWn0CtG/iE0SQRy3rBP7imQpVtpXm5N14=; h=Date:To:From:Subject:From; b=wu3mf3geZfCQ9PuyR3Xx0gLidmn8rrBHfi8IDkunT6HLgje+Ud9JZ6cFQdgxX/Mqx RTannVa39DR65miwG9GpnNjeh7vRADsQUFeFnbEou1VbN+0F2WuLXwVChLLZTMJ2QW wk44vTbtk4SvchOsuOdVJOsdt8r602qq/6zUvXgk=
? 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