A082266 In the array shown below the n-th row contains all the palindromes that use digits > 0 and have a digit sum of n. The sequence contains the array read by rows.
1, 2, 11, 3, 111, 4, 22, 121, 1111, 5, 131, 212, 11111, 6, 33, 141, 222, 1221, 2112, 11211, 111111, 7, 151, 232, 313, 11311, 12121, 21112, 1111111, 8, 44, 161, 242, 323, 1331, 2222, 3113, 11411, 12221, 21212, 112211, 121121, 211112, 1112111, 11111111
Offset: 1
Examples
In the following array the n-th row contains all the palindromes that use digits > 0 and have a digit sum of n. 1 2 11 3 111 4 22 121 1111 5 131 212 11111 6 33 141 222 1221 2112 111111 ... The sequence contains the array read by rows.
Programs
-
Maple
isPali := proc(perm) local i ; for i from 1 to nops(perm)/2 do if op(i,perm) <> op(-i,perm) then RETURN(false) ; fi ; od ; RETURN(true) ; end: isSingDig := proc(perm) local i ; for i from 1 to nops(perm) do if op(i,perm)>9 then RETURN(false) ; fi ; od ; RETURN(true) ; end: A082266 := proc(n) local arow,npart,pindx,part,perm,i,cand,j,pali ; arow := [] ; npart := combinat[partition](n) ; for pindx from 1 to nops(npart) do part := op(pindx,npart) ; perm := combinat[permute](part) ; for i from 1 to nops(perm) do cand := op(i,perm) ; if isSingDig(cand) and isPali(cand) then pali := add( op(j,cand)*10^(j-1),j=1..nops(cand) ) ; arow := [op(arow),pali] ; fi ; od ; od ; RETURN(sort(arow)) ; end: for n from 1 to 10 do arow := A082266(n) : for i from 1 to nops(arow) do printf("%d,",op(i,arow)) ; od : od : # R. J. Mathar, Mar 07 2007
Formula
For formulas see A082267.
Extensions
Corrected and extended by R. J. Mathar, Mar 07 2007