Skip Menu |

This queue is for tickets about the Math-BaseCalc CPAN distribution.

Report information
The Basics
Id: 105224
Status: rejected
Worked: 5 min
Priority: 0/
Queue: Math-BaseCalc

People
Owner: kwilliams [...] cpan.org
Requestors: blue [...] thisisnotmyrealemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: not working as expected for this example
consider the case where digits are 1..9, $calc9 = new Math::BaseCalc(digits=>[1..9]); this has nine digits, so should represent base9 this corresponds to the integer series as described here: http://oeis.org/A052382 Using the example on that page: $ perl -Mblib -MMath::BaseCalc -E 'my $calc = new Math::BaseCalc(digits => [0..8]); my $b = $calc->to_base(729); say $b' 1000 $ perl -Mblib -MMath::BaseCalc -E 'my $calc = new Math::BaseCalc(digits => [1..9]); my $b = $calc->to_base(729); say $b' 2111 this result is wrong, it should be 889.
you're correct that this is base 9, but it's not the same sequence as the page you cite. When you pass '1' as the first digit, that becomes the Zero digit. So no numbers can start with that digit, just as no positive integers in our base 10 counting start with 0.
The counting numbers in this system would be 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, etc.