static void Main(string[] args)
BigInteger inicio = BigInteger.Parse("100000");
BigInteger fin = BigInteger.Parse("400000");
if (contador % 10000 == 0)
Console.WriteLine($"Procesando número: {i}");
string numberString = i.ToString();
int length = numberString.Length;
for (int j = 0; j < length; j++)
string rotatedString = RotateString(numberString, j);
if (rotatedString[0] == '0')
BigInteger rotatedNumber = BigInteger.Parse(rotatedString);
if (rotatedNumber >= i && rotatedNumber <= fin)
string rotatedStringInverse = RotateString(numberString, length - j);
if (rotatedStringInverse[0] == '0')
BigInteger rotatedNumberInverse = BigInteger.Parse(rotatedStringInverse);
if (rotatedNumberInverse >= i && rotatedNumberInverse <= fin && valido)
Console.WriteLine(rotatedNumber);
Console.WriteLine("Proceso finalizado.");
static string RotateString(string s, int positions)
if (s.Length == 0) return s;
positions = positions % s.Length;
return s.Substring(positions) + s.Substring(0, positions);