login
Number of n-digit palindromes in base n.
1

%I #13 Sep 08 2022 08:45:15

%S 1,6,12,100,180,2058,3584,52488,90000,1610510,2737152,57921708,

%T 97883968,2392031250,4026531840,111612119056,187339329792,

%U 5808378560022,9728000000000,333597619564020,557758378619904,20961814674106394,34998666292887552,1430511474609375000

%N Number of n-digit palindromes in base n.

%H G. C. Greubel, <a href="/A099767/b099767.txt">Table of n, a(n) for n = 2..700</a>

%F a(n) = (n-1)*n^(floor((n+1)/2) - 1).

%e a(3) = 6 because there are 6 3-digit palindromes in base 3, namely 101, 111, 121, 202, 212, 222.

%p seq((n-1)*n^(floor((n+1)/2) -1), n=2..30); # _G. C. Greubel_, Sep 03 2019

%t (n-1)*n^(Floor[(n+1)/2] -1) /. n -> Range[2, 30]

%o (PARI) vector(30, n, n*(n+1)^((n+2)\2 -1) ) \\ _G. C. Greubel_, Sep 03 2019

%o (Magma) [(n-1)*n^(Floor((n+1)/2) - 1): n in [2..30]]; // _G. C. Greubel_, Sep 03 2019

%o (Sage) [(n-1)*n^(floor((n+1)/2) - 1) for n in (2..30)] # _G. C. Greubel_, Sep 03 2019

%o (GAP) List([2..30], n-> (n-1)*n^(Int((n+1)/2) - 1)); # _G. C. Greubel_, Sep 03 2019

%K easy,nonn,base

%O 2,2

%A Anonymous, Nov 11 2004

%E Terms a(21) onward added by _G. C. Greubel_, Sep 03 2019