WeixiangYan/CodeTransOcean huggingface dataset:
Task: Ormiston triples




Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    const limit = 1e10
    primes := rcu.Primes(limit)
    var orm25 []int
    j := int(1e9)
    count := 0
    var counts []int
    for i := 0; i < len(primes)-2; i++ {
        p1 := primes[i]
        p2 := primes[i+1]
        p3 := primes[i+2]
        if (p2-p1)%18 != 0 || (p3-p2)%18 != 0 {
            continue
        }
        key1 := 1
        for _, dig := range rcu.Digits(p1, 10) {
            key1 *= primes[dig]
        }
        key2 := 1
        for _, dig := range rcu.Digits(p2, 10) {
            key2 *= primes[dig]
        }
        if key1 != key2 {
            continue
        }
        key3 := 1
        for _, dig := range rcu.Digits(p3, 10) {
            key3 *= primes[dig]
        }
        if key2 == key3 {
            if count < 25 {
                orm25 = append(orm25, p1)
            }
            if p1 >= j {
                counts = append(counts, count)
                j *= 10
            }
            count++
        }
    }
    counts = append(counts, count)
    fmt.Println("Smallest members of first 25 Ormiston triples:")
    for i := 0; i < 25; i++ {
        fmt.Printf("%8v ", orm25[i])
        if (i+1)%5 == 0 {
            fmt.Println()
        }
    }
    fmt.Println()
    j = int(1e9)
    for i := 0; i < len(counts); i++ {
        fmt.Printf("%s Ormiston triples before %s\n", rcu.Commatize(counts[i]), rcu.Commatize(j))
        j *= 10
        fmt.Println()
    }
}




Python: import textwrap

from itertools import pairwise
from typing import Iterator
from typing import List

import primesieve


def primes() -> Iterator[int]:
    it = primesieve.Iterator()
    while True:
        yield it.next_prime()


def triplewise(iterable):
    for (a, _), (b, c) in pairwise(pairwise(iterable)):
        yield a, b, c


def is_anagram(a: int, b: int, c: int) -> bool:
    return sorted(str(a)) == sorted(str(b)) == sorted(str(c))


def up_to_one_billion() -> int:
    count = 0
    for triple in triplewise(primes()):
        if is_anagram(*triple):
            count += 1
        if triple[2] >= 1_000_000_000:
            break
    return count


def up_to_ten_billion() -> int:
    count = 0
    for triple in triplewise(primes()):
        if is_anagram(*triple):
            count += 1
        if triple[2] >= 10_000_000_000:
            break
    return count


def first_25() -> List[int]:
    rv: List[int] = []
    for triple in triplewise(primes()):
        if is_anagram(*triple):
            rv.append(triple[0])
            if len(rv) >= 25:
                break
    return rv


if __name__ == "__main__":
    print("Smallest members of first 25 Ormiston triples:")
    print(textwrap.fill(" ".join(str(i) for i in first_25())), "\n")
    print(up_to_one_billion(), "Ormiston triples before 1,000,000,000")
    print(up_to_ten_billion(), "Ormiston triples before 10,000,000,000")
Task: Elementary cellular automaton_Infinite length




Go: package main

import (
    "fmt"
    "strings"
)

func btoi(b bool) int {
    if b {
        return 1
    }
    return 0
}

func evolve(l, rule int) {
    fmt.Printf(" Rule #%d:\n", rule)
    cells := "O"
    for x := 0; x < l; x++ {
        cells = addNoCells(cells)
        width := 40 + (len(cells) >> 1)
        fmt.Printf("%*s\n", width, cells)
        cells = step(cells, rule)
    }
}

func step(cells string, rule int) string {
    newCells := new(strings.Builder)
    for i := 0; i < len(cells)-2; i++ {
        bin := 0
        b := uint(2)
        for n := i; n < i+3; n++ {
            bin += btoi(cells[n] == 'O') << b
            b >>= 1
        }
        a := '.'
        if rule&(1<<uint(bin)) != 0 {
            a = 'O'
        }
        newCells.WriteRune(a)
    }
    return newCells.String()
}

func addNoCells(cells string) string {
    l, r := "O", "O"
    if cells[0] == 'O' {
        l = "."
    }
    if cells[len(cells)-1] == 'O' {
        r = "."
    }
    cells = l + cells + r
    cells = l + cells + r
    return cells
}

func main() {
    for _, r := range []int{90, 30} {
        evolve(25, r)
        fmt.Println()
    }
}




Python: def _notcell(c):
    return '0' if c == '1' else '1'

def eca_infinite(cells, rule):
    lencells = len(cells)
    rulebits = '{0:08b}'.format(rule)
    neighbours2next = {'{0:03b}'.format(n):rulebits[::-1][n] for n in range(8)}
    c = cells
    while True:
        yield c
        c = _notcell(c[0])*2 + c + _notcell(c[-1])*2    

        c = ''.join(neighbours2next[c[i-1:i+2]] for i in range(1,len(c) - 1))
        

if __name__ == '__main__':
    lines = 25
    for rule in (90, 30):
        print('\nRule: %i' % rule)
        for i, c in zip(range(lines), eca_infinite('1', rule)):
            print('%2i: %s%s' % (i, ' '*(lines - i), c.replace('0', '.').replace('1', '
Task: Even numbers which cannot be expressed as the sum of two twin primes




Go: package main

import (
    "fmt"
    "rcu"
)

const limit = 100000 

func nonTwinSums(twins []int) []int {
    sieve := make([]bool, limit+1)
    for i := 0; i < len(twins); i++ {
        for j := i; j < len(twins); j++ {
            sum := twins[i] + twins[j]
            if sum > limit {
                break
            }
            sieve[sum] = true
        }
    }
    var res []int
    for i := 2; i < limit; i += 2 {
        if !sieve[i] {
            res = append(res, i)
        }
    }
    return res
}

func main() {
    primes := rcu.Primes(limit)[2:] 
    twins := []int{3}
    for i := 0; i < len(primes)-1; i++ {
        if primes[i+1]-primes[i] == 2 {
            if twins[len(twins)-1] != primes[i] {
                twins = append(twins, primes[i])
            }
            twins = append(twins, primes[i+1])
        }
    }
    fmt.Println("Non twin prime sums:")
    ntps := nonTwinSums(twins)
    rcu.PrintTable(ntps, 10, 4, false)
    fmt.Println("Found", len(ntps))

    fmt.Println("\nNon twin prime sums (including 1):")
    twins = append([]int{1}, twins...)
    ntps = nonTwinSums(twins)
    rcu.PrintTable(ntps, 10, 4, false)
    fmt.Println("Found", len(ntps))
}




Python: 

from sympy import sieve


def nonpairsums(include1=False, limit=20_000):
    
    tpri = [i in sieve and (i - 2 in sieve or i + 2 in sieve)
            for i in range(limit+2)]
    if include1:
        tpri[1] = True
    twinsums = [False] * (limit * 2)
    for i in range(limit):
        for j in range(limit-i+1):
            if tpri[i] and tpri[j]:
                twinsums[i + j] = True

    return [i for i in range(2, limit+1, 2) if not twinsums[i]]


print('Non twin prime sums:')
for k, p in enumerate(nonpairsums()):
    print(f'{p:6}', end='\n' if (k + 1) % 10 == 0 else '')

print('\n\nNon twin prime sums (including 1):')
for k, p in enumerate(nonpairsums(include1=True)):
    print(f'{p:6}', end='\n' if (k + 1) % 10 == 0 else '')
Task: Primes with digits in nondecreasing order




Go: package main

import (
    "fmt"
    "rcu"
)

func nonDescending(p int) bool {
    var digits []int
    for p > 0 {
        digits = append(digits, p%10)
        p = p / 10
    }
    for i := 0; i < len(digits)-1; i++ {
        if digits[i+1] > digits[i] {
            return false
        }
    }
    return true
}

func main() {
    primes := rcu.Primes(999)
    var nonDesc []int
    for _, p := range primes {
        if nonDescending(p) {
            nonDesc = append(nonDesc, p)
        }
    }
    fmt.Println("Primes below 1,000 with digits in non-decreasing order:")
    for i, n := range nonDesc {
        fmt.Printf("%3d ", n)
        if (i+1)%10 == 0 {
            fmt.Println()
        }
    }
    fmt.Printf("\n%d such primes found.\n", len(nonDesc))
}




Python: 

from operator import le
from itertools import takewhile



def monotonicDigits(base):
    
    def go(n):
        return monotonic(le)(
            showIntAtBase(base)(digitFromInt)(n)('')
        )
    return go



def monotonic(op):
    
    def go(xs):
        return all(map(op, xs, xs[1:]))
    return go




def main():
    
    xs = [
        str(n) for n in takewhile(
            lambda n: 1000 > n,
            filter(monotonicDigits(10), primes())
        )
    ]
    w = len(xs[-1])
    print(f'{len(xs)} matches for base 10:\n')
    print('\n'.join(
        ' '.join(row) for row in chunksOf(10)([
            x.rjust(w, ' ') for x in xs
        ])
    ))





def chunksOf(n):
    
    def go(xs):
        return (
            xs[i:n + i] for i in range(0, len(xs), n)
        ) if 0 < n else None
    return go



def digitFromInt(n):
    
    return '0123456789abcdefghijklmnopqrstuvwxyz'[n] if (
        0 <= n < 36
    ) else '?'



def primes():
    
    n = 2
    dct = {}
    while True:
        if n in dct:
            for p in dct[n]:
                dct.setdefault(n + p, []).append(p)
            del dct[n]
        else:
            yield n
            dct[n * n] = [n]
        n = 1 + n




def showIntAtBase(base):
    
    def wrap(toChr, n, rs):
        def go(nd, r):
            n, d = nd
            r_ = toChr(d) + r
            return go(divmod(n, base), r_) if 0 != n else r_
        return 'unsupported base' if 1 >= base else (
            'negative number' if 0 > n else (
                go(divmod(n, base), rs))
        )
    return lambda toChr: lambda n: lambda rs: (
        wrap(toChr, n, rs)
    )



if __name__ == '__main__':
    main()
Task: Reflection_List properties




Go: package main

import (
	"fmt"
	"image"
	"reflect"
)


type t struct {
	X    int
	next *t
}

func main() {
	report(t{})
	report(image.Point{})
}

func report(x interface{}) {
	t := reflect.TypeOf(x)
	n := t.NumField()
	fmt.Printf("Type %v has %d fields:\n", t, n)
	fmt.Println("Name     Type     Exported")
	for i := 0; i < n; i++ {
		f := t.Field(i)
		fmt.Printf("%-8s %-8v %-8t\n",
			f.Name,
			f.Type,
			f.PkgPath == "",
		)
	}
	fmt.Println()
}




Python: class Parent(object):
    __priv = 'private'
    
    def __init__(self, name):
        self.name = name
    
    def __repr__(self):
        return '%s(%s)' % (type(self).__name__, self.name)
    
    def doNothing(self):
        pass

import re

class Child(Parent):
    
    __rePrivate = re.compile('^_(Child|Parent)__')
    
    __reBleh = re.compile('\Wbleh$')
    @property
    def reBleh(self):
        return self.__reBleh
    
    def __init__(self, name, *args):
        super(Child, self).__init__(name)
        self.args = args
    
    def __dir__(self):
        myDir = filter(
            
            lambda p: not self.__rePrivate.match(p),
            list(set( \
                sum([dir(base) for base in type(self).__bases__], []) \
                + type(self).__dict__.keys() \
                + self.__dict__.keys() \
            )))
        return myDir + map(
            
            lambda p: p + '_bleh',
            filter(
                
                lambda p: (p[:2] != '__' or p[-2:] != '__') and not callable(getattr(self, p)),
                myDir))
    
    def __getattr__(self, name):
        if name[-5:] == '_bleh':
            
            return str(getattr(self, name[:-5])) + ' bleh'
        if hasattr(super(Child, chld), '__getattr__'):
            return super(Child, self).__getattr__(name)
        raise AttributeError("'%s' object has no attribute '%s'" % (type(self).__name__, name))
    
    def __setattr__(self, name, value):
        if name[-5:] == '_bleh':
            
            if not (hasattr(self, name[:-5]) and callable(getattr(self, name[:-5]))):
                setattr(self, name[:-5], self.reBleh.sub('', value))
        elif hasattr(super(Child, self), '__setattr__'):
            super(Child, self).__setattr__(name, value)
        elif hasattr(self, '__dict__'):
            self.__dict__[name] = value
    
    def __repr__(self):
        return '%s(%s, %s)' % (type(self).__name__, self.name, str(self.args).strip('[]()'))
    
    def doStuff(self):
        return (1+1.0/1e6) ** 1e6

par = Parent('par')
par.parent = True
dir(par)

inspect.getmembers(par)


chld = Child('chld', 0, 'I', 'two')
chld.own = "chld's own"
dir(chld)

inspect.getmembers(chld)
Task: Align columns




Go: package main

import (
    "fmt"
    "strings"
)

const text = `Given$a$text$file$of$many$lines,$where$fields$within$a$line$
are$delineated$by$a$single$'dollar'$character,$write$a$program
that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$
column$are$separated$by$at$least$one$space.
Further,$allow$for$each$word$in$a$column$to$be$either$left$
justified,$right$justified,$or$center$justified$within$its$column.`

type formatter struct {
    text  [][]string
    width []int
}

func newFormatter(text string) *formatter {
    var f formatter
    for _, line := range strings.Split(text, "\n") {
        words := strings.Split(line, "$")
        for words[len(words)-1] == "" {
            words = words[:len(words)-1]
        }
        f.text = append(f.text, words)
        for i, word := range words {
            if i == len(f.width) {
                f.width = append(f.width, len(word))
            } else if len(word) > f.width[i] {
                f.width[i] = len(word)
            }
        }
    }
    return &f
}

const (
    left = iota
    middle
    right
)

func (f formatter) print(j int) {
    for _, line := range f.text {
        for i, word := range line {
            fmt.Printf("%-*s ", f.width[i], fmt.Sprintf("%*s",
                len(word)+(f.width[i]-len(word))*j/2, word))
        }
        fmt.Println("")
    }
    fmt.Println("")
}

func main() {
    f := newFormatter(text)
    f.print(left)
    f.print(middle)
    f.print(right)
}




Python: from itertools import zip_longest

txt = 
 
parts = [line.rstrip("$").split("$") for line in txt.splitlines()]
widths = [max(len(word) for word in col) 
          for col in zip_longest(*parts, fillvalue='')]
 
for justify in "<_Left ^_Center >_Right".split():
    j, jtext = justify.split('_')
    print(f"{jtext} column-aligned output:\n")
    for line in parts:
        print(' '.join(f"{wrd:{j}{wdth}}" for wdth, wrd in zip(widths, line)))
    print("- " * 52)
Task: URL parser




Go: package main

import (
	"fmt"
	"log"
	"net"
	"net/url"
)

func main() {
	for _, in := range []string{
		"foo:
		"urn:example:animal:ferret:nose",
		"jdbc:mysql:
		"ftp:
		"http:
		"ldap:
		"mailto:John.Doe@example.com",
		"news:comp.infosystems.www.servers.unix",
		"tel:+1-816-555-1212",
		"telnet:
		"urn:oasis:names:specification:docbook:dtd:xml:4.1.2",

		"ssh:
		"https:
		"http:
	} {
		fmt.Println(in)
		u, err := url.Parse(in)
		if err != nil {
			log.Println(err)
			continue
		}
		if in != u.String() {
			fmt.Printf("Note: reassmebles as %q\n", u)
		}
		printURL(u)
	}
}

func printURL(u *url.URL) {
	fmt.Println("    Scheme:", u.Scheme)
	if u.Opaque != "" {
		fmt.Println("    Opaque:", u.Opaque)
	}
	if u.User != nil {
		fmt.Println("    Username:", u.User.Username())
		if pwd, ok := u.User.Password(); ok {
			fmt.Println("    Password:", pwd)
		}
	}
	if u.Host != "" {
		if host, port, err := net.SplitHostPort(u.Host); err == nil {
			fmt.Println("    Host:", host)
			fmt.Println("    Port:", port)
		} else {
			fmt.Println("    Host:", u.Host)
		}
	}
	if u.Path != "" {
		fmt.Println("    Path:", u.Path)
	}
	if u.RawQuery != "" {
		fmt.Println("    RawQuery:", u.RawQuery)
		m, err := url.ParseQuery(u.RawQuery)
		if err == nil {
			for k, v := range m {
				fmt.Printf("        Key: %q Values: %q\n", k, v)
			}
		}
	}
	if u.Fragment != "" {
		fmt.Println("    Fragment:", u.Fragment)
	}
}




Python: import urllib.parse as up 

url = up.urlparse('http://user:pass@example.com:8081/path/file.html;params?query1=1

print('url.scheme = ', url.scheme)
print('url.netloc = ', url.netloc)
print('url.hostname = ', url.hostname)
print('url.port = ', url.port)
print('url.path = ', url.path)
print('url.params = ', url.params)
print('url.query = ', url.query)
print('url.fragment = ', url.fragment)
print('url.username = ', url.username)
print('url.password = ', url.password)
Task: Idoneal numbers




Go: package main

import "rcu"

func isIdoneal(n int) bool {
    for a := 1; a < n; a++ {
        for b := a + 1; b < n; b++ {
            if a*b+a+b > n {
                break
            }
            for c := b + 1; c < n; c++ {
                sum := a*b + b*c + a*c
                if sum == n {
                    return false
                }
                if sum > n {
                    break
                }
            }
        }
    }
    return true
}

func main() {
    var idoneals []int
    for n := 1; n <= 1850; n++ {
        if isIdoneal(n) {
            idoneals = append(idoneals, n)
        }
    }
    rcu.PrintTable(idoneals, 13, 4, false)
}




Python: 


def is_idoneal(num):
    
    for a in range(1, num):
        for b in range(a + 1, num):
            if a * b + a + b > num:
                break
            for c in range(b + 1, num):
                sum3 = a * b + b * c + a * c
                if sum3 == num:
                    return False
                if sum3 > num:
                    break
    return True


row = 0
for n in range(1, 2000):
    if is_idoneal(n):
        row += 1
        print(f'{n:5}', end='\n' if row % 13 == 0 else '')
Task: Base58Check encoding




Go: package main

import (
    "fmt"
    "log"
    "math/big"
    "strings"
)

const alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

var big0 = new(big.Int)
var big58 = big.NewInt(58)

func reverse(s string) string {
    r := []rune(s)
    for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
        r[i], r[j] = r[j], r[i]
    }
    return string(r)
}

func convertToBase58(hash string, base int) (string, error) {
    var x, ok = new(big.Int).SetString(hash, base)
    if !ok {
        return "", fmt.Errorf("'%v' is not a valid integer in base '%d'", hash, base)
    }
    var sb strings.Builder
    var rem = new(big.Int)
    for x.Cmp(big0) == 1 {
        x.QuoRem(x, big58, rem)
        r := rem.Int64()
        sb.WriteByte(alphabet[r])
    }
    return reverse(sb.String()), nil
}

func main() {
    s := "25420294593250030202636073700053352635053786165627414518"
    b, err := convertToBase58(s, 10)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(s, "->", b)
    hashes := [...]string{
        "0x61",
        "0x626262",
        "0x636363",
        "0x73696d706c792061206c6f6e6720737472696e67",
        "0x516b6fcd0f",
        "0xbf4f89001e670274dd",
        "0x572e4794",
        "0xecac89cad93923c02321",
        "0x10c8511e",
    }
    for _, hash := range hashes {
        b58, err := convertToBase58(hash, 0)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("%-56s -> %s\n", hash, b58)
    }
}




Python: ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

def convertToBase58(num):
    sb = ''
    while (num > 0):
        r = num % 58
        sb = sb + ALPHABET[r]
        num = num // 58;
    return sb[::-1]

s = 25420294593250030202636073700053352635053786165627414518
b = convertToBase58(s)
print("%-56d -> %s" % (s, b))

hash_arr = [0x61, 0x626262, 0x636363, 0x73696d706c792061206c6f6e6720737472696e67, 0x516b6fcd0f, 0xbf4f89001e670274dd, 0x572e4794, 0xecac89cad93923c02321, 0x10c8511e]
for num in hash_arr:
    b = convertToBase58(num)
    print("0x%-54x -> %s" % (num, b))
Task: Dynamic variable names




Go: package main

import (
    "bufio"
    "fmt"
    "log"
    "os"
    "strconv"
    "strings"
)

func check(err error) {
    if err != nil {
        log.Fatal(err)
    }
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    n := 0
    for n < 1 || n > 5 {
        fmt.Print("How many integer variables do you want to create (max 5) : ")
        scanner.Scan()
        n, _ = strconv.Atoi(scanner.Text())
        check(scanner.Err())
    }
    vars := make(map[string]int)
    fmt.Println("OK, enter the variable names and their values, below")
    for i := 1; i <= n; {
        fmt.Println("\n  Variable", i)
        fmt.Print("    Name  : ")
        scanner.Scan()
        name := scanner.Text()
        check(scanner.Err())
        if _, ok := vars[name]; ok {
            fmt.Println("  Sorry, you've already created a variable of that name, try again")
            continue
        }
        var value int
        var err error
        for {
            fmt.Print("    Value : ")
            scanner.Scan()
            value, err = strconv.Atoi(scanner.Text())
            check(scanner.Err())
            if err != nil {
                fmt.Println("  Not a valid integer, try again")
            } else {
                break
            }
        }
        vars[name] = value
        i++
    }
    fmt.Println("\nEnter q to quit")
    for {
        fmt.Print("\nWhich variable do you want to inspect : ")
        scanner.Scan()
        name := scanner.Text()
        check(scanner.Err())
        if s := strings.ToLower(name); s == "q" {
            return
        }
        v, ok := vars[name]
        if !ok {
            fmt.Println("Sorry there's no variable of that name, try again")
        } else {
            fmt.Println("It's value is", v)
        }
    }
}




Python: >>> name = raw_input("Enter a variable name: ")
Enter a variable name: X
>>> globals()[name] = 42
>>> X
42
Task: Largest palindrome product




Go: package main

import "fmt"

func reverse(n uint64) uint64 {
    r := uint64(0)
    for n > 0 {
        r = n%10 + r*10
        n /= 10
    }
    return r
}

func main() {
    pow := uint64(10)
nextN:
    for n := 2; n < 10; n++ {
        low := pow * 9
        pow *= 10
        high := pow - 1
        fmt.Printf("Largest palindromic product of two %d-digit integers: ", n)
        for i := high; i >= low; i-- {
            j := reverse(i)
            p := i*pow + j
            
            for k := high; k > low; k -= 2 {
                if k % 10 == 5 {
                    continue
                }
                l := p / k
                if l > high {
                    break
                }
                if p%k == 0 {
                    fmt.Printf("%d x %d = %d\n", k, l, p)
                    continue nextN
                }
            }
        }
    }
}




Python: 

T=[set([(0, 0)])]

def double(it):
    for a, b in it:
        yield a, b
        yield b, a

def tails(n):
    
    if len(T)<=n:
        l = set()
        for i in range(10):
            for j in range(i, 10):
                I = i*10**(n-1)
                J = j*10**(n-1)
                it = tails(n-1)
                if I!=J: it = double(it)
                for t1, t2 in it:
                    if ((I+t1)*(J+t2)+1)%10**n == 0:
                        l.add((I+t1, J+t2))
        T.append(l)
    return T[n]

def largestPalindrome(n):
    
    m, tail = 0, n // 2
    head = n - tail
    up = 10**head
    for L in range(1, 9*10**(head-1)+1):
        
        m = 0
        sol = None
        for i in range(1, L + 1):
            lo = max(i, int(up - (up - L + 1)**2 / (up - i)) + 1)
            hi = int(up - (up - L)**2 / (up - i))
            for j in range(lo, hi + 1):
                I = (up-i) * 10**tail
                J = (up-j) * 10**tail
                it = tails(tail)
                if I!=J: it = double(it)
                    for t1, t2 in it:
                        val = (I + t1)*(J + t2)
                        s = str(val)
                        if s == s[::-1] and val>m:
                            sol = (I + t1, J + t2)
                            m = val

        if m:
            print("{:2d}\t{:4d}".format(n, m % 1337), sol, sol[0] * sol[1])
            return m % 1337
    return 0

if __name__ == "__main__":
    for k in range(1, 14):
        largestPalindrome(k)