Specifically for [livejournal.com profile] coldtortuga

Jan. 1st, 2006 01:56 pm
pmb: (Default)
[personal profile] pmb
A variation on a previous theme:
BaseNumberNumber in Base 10
2121
3232
4312454
54135108
64126152
765142716200
8762513482042460
9827153694416720
109867312109867312
Still churning - these O(nn) algorithms really soak up the CPU time...
(I later hit Ctrl-C, so all numbers after this point are from [livejournal.com profile] coldtortuga)
11A98762413112334364200
12B935217612421877610
13CBA95847213131779700673520

Date: 2006-01-10 09:46 pm (UTC)
From: [identity profile] coldtortuga.livejournal.com
My "heuristic" approach pretty much follows the algorithm described by [livejournal.com profile] pmb, which is (as ya'll surmise) O(n!).

In base n, start with the set of usable digits D={1, ..., n-1}. For each non-empty subset d of D (in Gray-code order, 'cause I already had a Gray-code subset generator), I find and test all the permutations of d (in the order given by Heaps' algorithm, 'cause I already had Heaps coded up). Gray-code + Heaps' algo does not the most efficient search-order make, but it's not too shabby.

The number of candidates to test in base n is given by A007526 which grows like e*n!

Profile

pmb: (Default)
pmb

October 2009

S M T W T F S
    1 23
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 17th, 2026 05:02 pm
Powered by Dreamwidth Studios