OFFSET
1,2
COMMENTS
A051596-restricted compositions of n.
LINKS
Robert Israel, Table of n, a(n) for n = 1..3300
Wikipedia, Gematria
FORMULA
From Doron Zeilberger, Nov 23 2020: (Start)
G.f.: Sum(a(n)*x^n, n=0..infinity) =
1/(1-add(x^i,i=1..9)-add(x^(10*i),i=1..9)-add(x^(100*i),i=1..4))
= 1/(1-x-...-x^9 - x^10- ... -x^90 - x^100-x^200-x^300-x^400).
Asymptotics:
a(n) ~ 0.50221591060212746248115807725009875743325273964521...*(1.9990196005347377028156443471636402056440270173905...)^n
If alpha is the smallest positive root of P:=1-x-...-x^9 - x^10- ... -x^90 - x^100-x^200-x^300-x^400=0
then the above asymptotic formula is exactly -(alpha*P'(alpha))* (1/alpha)^n.
(End)
EXAMPLE
The four strings with a gematria of 3 are:
אאא (111)
אב (12)
בא (21)
ג (3)
Note: Hebrew is written right-to-left, which is why the order of the digits appears to be reversed.
MAPLE
g:= 1/(1-add(x^i, i=1..9)-add(x^(10*i), i=1..9)-add(x^(100*i), i=1..4)):
S:= series(g, x, 101):
seq(coeff(S, x, n), n=1..100); # Robert Israel, Nov 25 2020
MATHEMATICA
Table[SeriesCoefficient[1/(1 - Sum[x^j, {j, Join[Range[9], 10 Range[9], 100 Range[4]]}]), {x, 0, n}], {n, 100}] (* Jan Mangaldan, Nov 27 2020 *)
PROG
(C#)int[] gematrias = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400 };
char[] letters = { 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת' };
//Calculates a(n) when you call CountStrings(n), and populates ListOfStrings with the list of valid strings that have gematria equal to n.
int CountStrings (int leftover, string stringOfLetters = "")
{
int count = 0;
foreach (int value in gematrias)
{
string secondString = "";
if (value == leftover)
{
count++;
secondString += letters[Array.IndexOf(gematrias, value)];
ListOfStrings.Items.Add(stringOfLetters + secondString);
}
else if (value < leftover)
{
secondString += letters[Array.IndexOf(gematrias, value)];
count += CountStrings(leftover-value, stringOfLetters + secondString);
}
}
return count;
}
CROSSREFS
KEYWORD
nonn,word
AUTHOR
Daniel Sterman, Nov 22 2020
EXTENSIONS
More terms from Robert Israel, Nov 25 2020
STATUS
approved