login
A061378
Product of all numbers formed by permuting the digits of n.
1
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 121, 252, 403, 574, 765, 976, 1207, 1458, 1729, 40, 252, 484, 736, 1008, 1300, 1612, 1944, 2296, 2668, 90, 403, 736, 1089, 1462, 1855, 2268, 2701, 3154, 3627, 160, 574, 1008, 1462, 1936, 2430, 2944, 3478, 4032, 4606, 250
OFFSET
0,3
COMMENTS
Differs from A062003 at those n which have more than two digits.
EXAMPLE
a(10) = 10*01 = 10, a(11) = 11*11 = 121, a(12) = 12*21 =252.
PROG
(ARIBAS): function permute(s: string): array; var i, k: integer; st1, st2: stack; ele, ws: string; begin stack_push(st2, s[0..0]); for i := 1 to length(s)-1 do while not stack_empty(st2) do stack_push(st1, stack_pop(st2)); end; ele := s[i]; while length(st1) > 0 do ws := stack_pop(st1); for k := 0 to length(ws)-1 do stack_push(st2, concat(ws[0..k-1], ele, ws[k..])); end; stack_push(st2, concat(ws[0..], ele)); end; end; return stack2array(st2); end; function int_permute(n: integer): array; var s: string; ar: array; i: integer; begin s := itoa(n); ar := permute(s); for i := 0 to length(ar)-1 do ar[i] := atoi(ar[i]); end; return ar; end; for k := 0 to 55 do write(product(int_permute(k)), " "); end;
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Klaus Brockhaus, Jun 08 2001
STATUS
approved