login
Number of 2n-digit decimal strings where the second half is an anagram of the first half.
1

%I #23 Apr 20 2026 23:40:56

%S 1,10,190,5140,175870,7132060,329009500,16786131400,928136093950,

%T 54775566167500,3410496772665940,222005754890212600,

%U 15000987483726651100,1046188137708903907000,74962723424363171666200,5498130019391836779330640,411530535654245301470621950,31356088574298606320386653100

%N Number of 2n-digit decimal strings where the second half is an anagram of the first half.

%C a(n) counts Abelian squares of length 2n over a 10-letter alphabet (strings xx' where x' is a permutation of x); i.e., f_{10}(n) in the notation of Richmond and Shallit (2008).

%C Consider all integers from 0 to 10^(2n)-1, written with leading zeros to pad to exactly 2n digits.

%C a(n) counts how many of these have the property that their second n digits are a rearrangement of their first n digits.

%H Jonathan M. Borwein, Dirk Nuyens, Armin Straub and James Wan, <a href="https://www.carmamaths.org/resources/jon/walks.pdf">Some Arithmetic Properties of Short Random Walk Integrals</a>, preprint, FPSAC 2010, San Francisco, USA.

%H Jean-Francois Im, <a href="https://blog.jean-francois.im/posts/palindromes-and-anagrams-in-totp-codes/">Palindromes and Anagrams in TOTP Codes</a>.

%H Jean-Francois Im, <a href="https://blog.jean-francois.im/posts/generalizing-totp-anagram-counting-for-different-bases/">Generalizing TOTP Anagram Counting for Different Bases</a>.

%H Jean-Francois Im, <a href="/A394980/a394980.py.txt">Python program</a>

%H L. Bruce Richmond and Jeffrey Shallit, <a href="https://arxiv.org/abs/0807.5028">Counting Abelian Squares</a>, arXiv:0807.5028 [math.CO], 2008.

%F a(n) = (n!)^2 [x^n] hypergeom([], [1], x)^10.

%F a(n) = A287316(n, 10).

%e For n=1 (2-digit strings), the 10 matches are 00, 11, 22, 33, 44, 55, 66, 77, 88, 99.

%e For n=2 (4-digit strings), the 190 matches include 0000, 0101, 0110, 0202, 0220.

%e For n=3 (6-digit strings), the 5140 matches include 000000, 111111, (1 unique digit in the first half), 001001, 001010, 001100 (2 unique digits in the first half), 012012, 012021, 012120, etc. for 3 unique digits in the first half.

%o (Python) # See Links

%Y Cf. A000984 (base 2), A002893 (base 3), A002895 (base 4), A169714 (base 5), A169715 (base 6), A385286 (base 8).

%Y Cf. A287316.

%K base,nonn

%O 0,2

%A _Jean-Francois Im_, Apr 08 2026