g | x | w | all
Bytes Lang Time Link
012Uiua241128T050054ZErikDaPa
032APLNARS250727T081139ZRosario
067Nim250725T141723ZjanAkali
008Vyxal 3250725T132136ZThemooni
012Pip250724T212543ZDLosc
016Dyalog APL250724T185932ZAaron
009Japt180208T180551ZShaggy
074AWK241129T164859Zxrs
006Vyxal230810T090537ZThe Thon
005Thunno 2230810T090427ZThe Thon
031RProgN161013T022116ZATaco
029QBIC170110T171813Zsteenber
044Python 2180208T175753Znedla200
014Japt170110T184645ZOliver
028Mathematica160826T053357ZGreg Mar
028Mathematica170110T150352ZMartin E
046REXX170104T091621Zidrougge
071Clojure170103T205245ZNikoNyrh
080C160827T214538Zuser5898
014Actually160825T151729ZSherlock
050Ruby161012T192308ZLee W
174Racket161012T160311Zrnso
076dc160830T235008Zseshouma
065Python 2160826T141119ZRageCage
109S.I.L.O.S160828T090448ZLeaky Nu
075Elixir160827T230807ZFlow
080C#160825T125412ZOmer Kah
101R160825T101702ZRudier
189C160825T161807ZValentin
039Perl 6160826T015631Zbb94
012Jelly160825T232112Zruds
035Perl 6160825T230501ZBrad Gil
025Perl160825T144347ZTon Hosp
049Mathematica160825T144324Zuser4881
076MATLAB160825T131143ZRichard
072PowerShell v2+160825T132739ZAdmBorkB
047VBSCRIPT160825T130948Zuser5155
0672sable / 05AB1E160825T065540ZEmigna
034Haskell160825T111110ZDamien
056Haskell160825T104526ZLaikoni
051Javascript ES6160825T073350ZLeaky Nu
010MATL160825T095746ZLuis Men
094Java160825T090725Zpeech
008Brachylog160825T064421ZLeaky Nu
009Pyke160825T075430ZBlue
039PHP160825T082929ZCrypto
046Python 2160825T070533ZLeaky Nu
007Pyth160825T064919ZJakube

Uiua, 12 bytes

⍢⊸+(¬≍⇌.°⋕).

Explanation:

⍢⊸+(¬≍⇌.°⋕).
           . => duplicate N
⍢            => then while
   (¬≍⇌.°⋕)  => the number is not a palindrome,
 ⊸+          => keep adding N

Try this online!

Desmos, 151 bytes

o(x)=mod(floorx,10)
p(x)=∏_{n=0}^D(1-sign(o(x/10^n)-o(10^{-D+n+1}x)))   => check if palindrome
D=floor(logx)+1                                     => # of digits
F(x,y)=\left\{p(x)(1-mod(x,y))=1:x,F(x+y,y)\right\} => recursively check if x is divisible by y and x is a palindrome, incrementing x each time
f(x)=F(x,x)                                         => optional argument filler (optional?)

Try this online!

APL(NARS), 32 chars

r←f w;y
r←w
→0×⍳y≡⌽y←⍕r⋄r+←w⋄→2

//8+4+20=32

The numbers in wich w is divisor are w, 2w, 3w ecc

test:

  f 1
 1
  f 2
 2
  f 16
 272
  f 17
 272
  f 42
 252
  f 111
 111
  f 302
 87278
  f 1234
 28382

Nim, 67 bytes

include random
proc(n=1):int=(var r=n;while $r!=reversed $r:r+=n;r)

Try it online! (with named function for convenience)

Vyxal 3, 8 bytes

⑵/⇄n?≛∧“

Vyxal It Online!

⑵/⇄n?≛∧“­⁡​‎‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁣‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏‏​⁡⁠⁡‌­
       “  # ‎⁡first integer where the lambda returns true
⑵         # ‎⁢lambda:
 /⇄       # ‎⁣n is invariant under reverse (it is a palindrome)
      ∧   # ‎⁤and
   n?≛    # ‎⁢⁡the input divides n
💎

Created with the help of Luminespire.

Online interpeter is too slow to compute for 302 in the time limit, but the snippet doesn't have a time limit (give it like a minute to think about it):

<script type="vyxal3">
⑵/⇄n?≛∧“
</script>
<script>
 args=[["1"],["2"],["16"],["17"],["42"],["111"],["1234"],["302"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>

Pip, 12 bytes

T(i+:a)=Ri0i

Attempt This Online!

Explanation

Iterative solution: Assign multiples of command-line input a to i until one of them is a palindrome; then stop and output i.

T(i+:a)=Ri0i
T             Loop until the following...
  i+:a          Add a to i in-place (i is initially 0)
 (    )=Ri      Is the new value of i equal to its reverse?
              ... is truthy:
          0     No-op
           i  After the loop, autoprint the value of i

Alternate solution, 12 bytes

i+:ai-Ri?Vfi

Attempt This Online!

Explanation

Recursive solution that does basically the same thing as the iterative one:

i+:ai-Ri?Vfi
i+:a          Add a to i in-place (i is initially 0)
    i-Ri      Calculate i minus reverse of i
        ?     If truthy (nonzero), i is not a palindrome, so:
         Vf     Evaluate the main function recursively with the same a and i
              Otherwise, i is a palindrome, so:
           i    Return i

Dyalog APL, 16 chars

{⍵+⍣((⊢≡⌽)⍕⍤⊣)0}

Was really jazzed about being able to golf this down from my ~40 char recursive solution. Explanation:

{              }
 ⍵+⍣(        )0   Add the left argument (input) to the right (initially 0) until the right operand is true
          ⍕⍤⊣     Discard the right argument (the last run) so we're keeping the left argument (the current run) and format as a string
     (   )        Palindrome check as a train
      ⊢             right argument
       ≡            matches
        ⌽           reversed right argument

Japt, 12 9 bytes

There's an 8 to be had here somehow.

È©vU}aÈsê

Try it

È©vU}aÈsê     :Implicit input of integer U
È             :Left function, taking an integer as argument
 ©            :  Logical AND with
  vU          :    Divisible by U?
    }         :End function
     a        :Pass the non-negative integers through the right function,
              : returning the first result that returns true
              : when passed through the left function
      È       :Right function, taking an integer as argument
       s      :  Convert to string
        ê     :    Palindromise and convert back to integer

AWK, 74 bytes

func f(n,r){return n?f(int(n/10),r*10+n%10):r}{for(x=$0;$0!=f($0);)$0+=x}1

reverse() - or better yet rev() - is the one function I'm always missing.

To Test:

awk 'func f(n,r){return n?f(int(n/10),r*10+n%10):r}{for(x=$0;$0!=f($0);)$0+=x}1' <<< 16

func f(n,r){return n?f(int(n/10),r*10+n%10):r} # reverse
{for(x=$0;$0!=f($0);)$0+=x}                    # while not palindrome
1                                              # print $0

Vyxal, 6 bytes

{:Ḃ≠|+

Try it Online!

Same as my Thunno 2 answer.

Explanation

{:Ḃ≠|+  # Implicit input
{       # While loop
 :      # (condition)  duplicate current number
   ≠    #              not equal to
  Ḃ     #              its reverse
    |+  # (body)  add the input
        # Implicit output

Thunno 2, 5 bytes

(ḲQ;+

Try it online!

Explanation

(ḲQ;+  # Implicit input
(      # While loop
  Q    # (condition)  not equal to
 Ḳ     #              its reverse
   ;+  # (body)  add the input
       # Implicit output

RProgN, 31 Bytes

►x=01¿1+]x*]''.S.\''.≡!}x*

Explained

►x=01¿1+]x*]''.S.\''.≡!}x*  # ► Defines spaceless segment.
 x=                         # Define the input as x
   01                       # Push 0, 1 to the stack. 1 is used as a truthy for the while, 0 is our incrementing product.
     ¿                 }    # While the value on top of the stack (popped) is truthy. 
      1+                    # Increment the product by one.
        ]x*                 # Duplicate the producter, multiply by the input.
           ]''.S.\''.≡!     # Check to see if the result is a palindrome.
           ]''.             # Push a duplicate of the multiplied number, convert to a string.
               S.           # Convert it to a stack and re-concatinate it. This reverses the string.
                 \''.≡!     # Flip the top two values, exposing the original product. Conver it to a string and test inverse equality.
                        x*  # Once the loop ends, the last number times the input will be a palindrome. Thus, do that.

The equality sugar was only added after the discovery of this challenge, as was the bugfix that allowed strings to be used in spaceless segments.

Try it Online!

QBIC, 29 bytes

:{c=a*q~!c$=_f!c$||_Xc\q=q+1

Explanation:

:      Get cmd line param as number 'a'
{      DO
c=a*q  multiply 'a' by 'q' (which is 1 at the start of a QBIC program) and assign to 'c'
~      IF
!c$    'c' cast to string
=      equals
_f!c$| 'c' cast to string, the reversed
|      THEN
_Xc    Quit, printing 'c'
\q=q+1 ELSE increment q and rerun
       DO Loop is auto-closed by QBIC, as is the IF

Python 2, 44 bytes

x=lambda n,m=0:m*(`m`==`m`[::-1])or x(n,m+n)

Try it online!

I know that the question was posted over six months ago, but this was shorter than any other Python submission.

Japt, 14 bytes

V±U s w ¥V?V:ß

Try it online!

Thank you ETHproductions for the help! :)

Mathematica, 34 28 bytes

#//.x_/;!PalindromeQ@x:>x+#&

Unnamed function taking a positive integer input and returning a positive integer. To be read as: "Starting with the function argument #, repeatedly replace any x we see that is not a palindrome with x+#." Yes, Virginia, there is a PalindromeQ! It only works in base 10 though.

Original submission:

(i=1;While@!PalindromeQ[++i#];i#)&

Mathematica, 28 bytes

#//.x_/;!PalindromeQ@x:>x+#&

Explanation

#//....

Repeatedly apply the following substitution to the input.

x_/;!PalindromeQ@x

Match a value which is not a palindrome.

...:>x+#

And replace that value with itself plus the input. This repeated substitution therefore searches through consecutive multiples of the input until it finds a palindrome.

REXX, 46 bytes

arg a
do n=a by a until reverse(n)=n
end
say n

Clojure, 71 bytes

#(first(for[i(rest(range))i[(str(* % i))]:when(=(seq i)(reverse i))]i))

Just one long for with a two-step generation of i.

C, not 83, 80 bytes

f(n,b,k,z){for(b=1;;){for(z=0,k=b*n;z+=k%10,k/=10;z*=10);if(b++*n==z)return z;}}

For say the true i had seen in one other puzzle one programmer use the same algo number=swapped(number) => number is palindrome. How is possible to edit barred text?

#include <stdio.h>
main()
{unsigned  a[]={0,1,2,3,16,17,42,111,302,1234}, i;
 for(i=0;i<10;++i)
   printf("f(a[%u])=f(%u)=%u\n", i, a[i], f(a[i], 0, 0, 0)); 
 return 0;
}

/*
 f(a[0])=f(0)=0
 f(a[1])=f(1)=1
 f(a[2])=f(2)=2
 f(a[3])=f(3)=3
 f(a[4])=f(16)=272
 f(a[5])=f(17)=272
 f(a[6])=f(42)=252
 f(a[7])=f(111)=111
 f(a[8])=f(302)=87278
 f(a[9])=f(1234)=28382
 */

Actually, 15 14 bytes

Asked to answer by Leaky Nun. Golfing suggestions welcome. Try it online!

╖2`╜*$;R=`╓N╜*

Ungolfing

          Implicit input n.
╖         Save n in register 0.
2`...`╓   Push first 2 values where f(x) is truthy, starting with f(0).
  ╜*$       Push register 0, multiply by x, and str().
  ;R        Duplicate str(n*x) and reverse.
  =         Check if str(n*x) == reverse(str(n*x)).
          The map will always result in [0, the x we want].
N         Grab the last (second) value of the resulting list.
╜*        Push n and multiply x by n again.
          Implicit return.

Ruby, 50 bytes

->n{a=n;while(s=a.to_s;s!=s.reverse)do a+=n;end;a}

It's horrible, I know.

Racket 174 bytes

(let((p?(λ(m)(equal? m(string->number(list->string(reverse(string->list(number->string m)))))))))
(let loop((N n))(cond[(and(p? N)(= 0(modulo N n)))N][else(loop(add1 N))])))

Ungolfed:

(define (f1 n)
  (let ((p? (λ (m)(equal? m
                          (string->number
                           (list->string
                            (reverse
                             (string->list
                              (number->string m)))))))))
    (let loop ((N n))
      (cond
        [(and (p? N) (= 0 (modulo N n))) N]
        [else (loop (add1 N))]
        ))))

Testing:

(f 1)
(f 2)
(f 16)
(f 17)
(f 42)
(f 111)
(f 302)
(f 1234)

Output:

1
2
272
272
252
111
87278
28382

dc, 85 78 76 bytes

[pq]sq?ddsI[dddZ0sR[1-dsD10r^rdsN10%*lR+sRlN10/lDd0<@]ds@xlR++=q+lIrlLx]dsLx

Run:

dc -f program.dc <<< "16"

Output:

272

Previously submitted code and explanation:

    # loads register 'q' with an exit function
[pq]sq
    # register '@' contains an iterative function to reverse a number (312 to 213),
#by calculating one coefficient at a time of the new base 10 polynomial
[1-dsD10r^rdsN10%*lR+sRlN10/lDd0<@]s@
    # register 'L' implements the logic. It iteratively compares the current value
#with the generated reversed one, exiting if equal, otherwise increments the value
#by N and repeats.
[dddZ0sRl@xlR++=q+lIrlLx]sL
    # the "main". It reads the input, then calls the solver function from 'L'.
?ddsIlLx

Python 2, 66 65 bytes

i is input and x is (eventually) output

def f(i,x):
    y=x if x%i==0&&`x`==`x`[::-1]else f(i,x+1)
    return y

After scrolling through other answers I found a shorter Python 2 answer but I put the effort into my solution so might as well throw it here. ¯\_(ツ)_/¯

S.I.L.O.S, 109 bytes

readIO 
n = 0
lbla
n + i
a = n
r = 0
lblb
m = a
m % 10
r * 10
r + m
a / 10
if a b
r - n
r |
if r a
printInt n

Try it online!

Elixir, 75 bytes

def f(p,a\\0),do: if'#{a+p}'|>Enum.reverse=='#{a+p}',do: a+p,else: f(p,a+p)

C#, 103 80 Bytes

int f(int p){int x=p;while(x+""!=string.Concat((x+"").Reverse()))x+=p;return x;}

Ungolfed

int f(int p)
{
   int x = p;
   while (x + "" != string.Concat((x + "").Reverse()))
      x += p;
   return x;
}

R, 117 113 109 101 bytes

D=charToRaw;P=paste;S=strtoi;a=P(i<-scan()+1);while(!all(D(a)==rev(D(a))&&S(a)%%i==0)){a=P(S(a)+1)};a

Ungolfed

i<-scan()        #Takes the input

D=charToRaw      #Some aliases
P=paste
S=strtoi
a=P(i+1)         #Initializes the output

while(!(all(D(a)==rev(D(a)))&&(S(a)%%i==0))) #While the output isn't a palindrom and isn't
                                             #divisible by the output...
    a=P(S(a)+1)

a

all(charToRaw(a)==rev(charToRaw(a))) checks if at each position of a the value of a and its reverse are the same (i.e., if a is palindromic).
It might be possible to golf out some bytes by messing around with the types.

C, 217 189 bytes

Standalone version :

int a(char*b){int c=strlen(b);for(int i=0;i<c/2;i++)if(b[i]!=b[c-i-1])return 0;}int main(int e,char **f){int b,c;char d[9];b=atoi(f[1]);c=b;while(1){sprintf(d,"%d",c);if(a(d)&&(c/b)*b==c)return printf("%d",c);c++;}}

Call to a function version :

int s(char*a){int b=strlen(a);for(int i=0;i<b/2;i++)if(a[i]!=a[b-i-1])return 0;}int f(int a){int b;char c[9];b=a;while(1){sprintf(c,"%d",b);if(s(c)&&(b/a)*a==b)return printf("%d",b);b++;}}

Ungolfed :

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

int check_palindrome(char *str) {
  int length = strlen(str);

  for (int i = 0; i < length / 2; i++) {
    if (str[i] != str[length - i - 1])
      return 0;
  }
  return 1;
}

int main(int argc, char **argv) {
  int number;
  int pal;
  char string[15];

  number = atoi(argv[1]);
  pal = number;
  while (1) {
    sprintf(string, "%d", pal);
    if (check_palindrome(string) && (pal / number) * number == pal)
      {
        printf("%d\n", pal);
        return 1;
      }
    pal++;
  }
  return 0;
}

Call to a function ungolfed :

int s(char *a) {
  int b = strlen(a);

  for (int i = 0; i < b / 2; i++) {
    if (a[i] != a[b - i - 1])
      return 0;
  }
  return 1; //We can remove it, it leads to a undefined behaviour but it works
}

int f(int a) {
  int b;
  char c[9];

  b = a;
  while (1) {
    sprintf(c, "%d", b);
    if (s(c) && (b / a) * a == b)
      {
        printf("%d\n", b); //no need for the \n
        return 1; //just return whatever printf returns, who cares anyway ?
      }
    b++;
  }
  return 0; //no need for that
}

I included the standalone version for historicity.

This is my first codegolf, any comment is welcome !

Perl 6, 39 bytes

my &f={first {.flip==$_},($_,2*$_...*)}

(33 not including the my &f=)

Jelly, 12 bytes

¹µ+³ßµDU⁼Dµ?

Try it online!

Explanation:

This link takes 1 argument. The µs split it into 4 parts. Starting from the last and moving left:

           ? The three parts in front of this are the if, else, and
             condition of a ternary expression.
      DU⁼D  This condition takes a number n as an argument. It converts
            n to an array of decimal digits, reverses that array, and
            then compares the reversed array to the decimalization of
            n (ie is n palindromic in decimal?)
  +³ß  This is the else. It adds the original input argument to n
       and then repeats the link with the new value of n.
¹  This is the if. It returns the value passed to it.

Perl 6, 35 bytes

->\N{first {$_%%N&&$_==.flip},N..*}
->\N{first {$_==.flip},(N,N*2...*)}
->\N{(N,N*2...*).first:{$_==.flip}}

Explanation:

-> \N {
  # from a list of all multiples of the input
  # ( deduced sequence )
  ( N, N * 2 ... * )

  # find the first
  .first:

  # that is a palindrome
  { $_ == .flip }
}

Perl, 25 bytes

Includes +2 for -ap

Run with the input on STDIN:

palidiv.pl <<< 16

palidiv.pl:

#!/usr/bin/perl -ap
$_+="@F"while$_-reverse

Mathematica, 49 bytes

(c=#;Not[PalindromeQ@c&&c~Mod~#==0]~While~c++;c)&

Starts the search at c = N, and increments c if not a palindrome and not divisible by N. When conditions are met, outputs c.

MATLAB, 76 bytes

function s=p(n)
f=1;s='01';while(any(s~=fliplr(s))) s=num2str(n*f);f=f+1;end

Call format is p(302) result is a string.

Nothing clever here. It does a linear search, using the num2str() and fliplr() functions.

This ugly arrangement is a touch shorter than using a while(1) ... if ... break end pattern.

Ungolfed

function s = findFirstPalindromeFactor(n)
  f = 1;                        % factor
  s = '01';                     % non-palindromic string for first try
  while( all(s ~= fliplr(s)) )  % test s not palindrome
    s = num2str( n * f );       % factor of input as string
    f = f + 1;                  % next factor
  end
 

PowerShell v2+, 72 bytes

for($i=$n=$args[0];;$i+=$n){if($i-eq-join"$i"["$i".Length..0]){$i;exit}}

Long because of how reversing is handled in PowerShell -- not very well. ;-)

Takes input $args[0], stores into $i (our loop variable) and $n (our input). Loops infinitely, incrementing $i by $n each time (to guarantee divisibility).

Each iteration, we check whether $i is a palindrome. There's some trickery happening here, so let me explain. We first take $i and stringify it with "$i". That's then array-indexed in reverse order ["$i".length..0] before being -joined back into a string. That's fed into the right-hand side of the -equality operator, which implicitly casts the string back into an [int], since that's the left-hand operand. Note: this casting does strip any leading zeros from the palindrome, but since we're guaranteed the input isn't divisible by 10, that's OK.

Then, if it is a palindrome, we simply place $i onto the pipeline and exit. Output is implicit at the end of execution.

Test Cases

PS C:\Tools\Scripts\golfing> 1,2,16,17,42,111,302,1234|%{"$_ -> "+(.\smallest-palindrome-divisible-by-input.ps1 $_)}
1 -> 1
2 -> 2
16 -> 272
17 -> 272
42 -> 252
111 -> 111
302 -> 87278
1234 -> 28382

VBSCRIPT, 47 bytes

do:i=i+1:a=n*i:loop until a=eval(strreverse(a))

ungolfed

do                     #starts the loop
i=i+1                  #increments i, we do it first to start at 1 instead of 0
a=                     #a is the output
n*i                    #multiply our input n by i
loop until 
a=eval(strreverse(a))  #end the loop when our output is equal to its reverse

2sable / 05AB1E, 6 / 7 bytes

2sable

[DÂQ#+

Explanation

[         # infinite loop
 D        # duplicate current number
  Â       # bifurcate
   Q#     # if the number is equal to its reverse, break loop
     +    # add input
          # implicitly print

Try it online

05AB1E

[DÂQ#¹+

The difference to the 2sable code is that input is only implicit once in 05AB1E, so here we need ¹ to get the first input again.

Try it online

Saved 1 byte with 2sable as suggested by Adnan

Haskell, 45 37 34 bytes

(+)>>=until((reverse>>=(==)).show)

Haskell, 64 63 56 bytes

x!n|mod x n==0,s<-show x,reverse s==s=x|y<-x+1=y!n
(1!)

Call with (1!)16 or simply 1!16. Try it on Ideone.

Javascript (ES6), 55 51 bytes

4 bytes thanks to Neil.

f=(x,c=x)=>c==[...c+""].reverse().join``?c:f(x,x+c)
<input type=number min=1 oninput=o.textContent=this.value%10&&f(+this.value)><pre id=o>

MATL, 10 bytes

0`G+tVtP<a

Try it online!

0      % Push 0
`      % Do...while
  G+   %   Add the input. This generates the next multiple of the input
  tV   %   Duplicate, convert to string
  tP   %   Duplicate, reverse
  <a   %   Is any digit lower than the one in the reverse string? This is the
       %   loop condition: if true, the loop proceeds with the next iteration
       % End do...while
       % Implicitly display

Java, 164 159 126 108 94 bytes

Golfed version:

int c(int a){int x=a;while(!(x+"").equals(new StringBuffer(x+"").reverse()+""))x+=a;return x;}

Ungolfed version:

int c(int a)
{
    int x = a;
    while (!(x + "").equals(new StringBuffer(x + "").reverse() + ""))
        x += a;
    return x;
}

Shoutout to Emigna and Kevin Cruijssen for contributing improvements and cutting the bytes almost in half :)

Brachylog, 8 bytes

:L#>*.r=

Try it online! (around 5 seconds for 1234)

Verify all testcases. (around 20 seconds)

:L#>*.r=
?:L#>*.r=.   Implicitly filling Input and Output:
             Input is prepended to every predicate,
             Output is appended to every predicate.

?:L  *.      Input*L is Output,
  L#>        L is positive,
      .r .   Output reversed is Output,
        =.   Assign a value to Output.

Pyke, 11 9 bytes

.f*`D_q)*

Try it here!

PHP, 39 bytes

while(strrev($i+=$argv[1])!=$i);echo$i;

Same length with for-loop

for(;strrev($i+=$argv[1])!=$i;);echo$i;

Python 2, 46 bytes

f=lambda x,c=0:`c`[::-1]==`c`and c or f(x,c+x)

Ideone it!

Recursive solution with c as counter.

The case for 0 is interesting, because although c=0 satisfies the palindrome condition, it would not be returned, because ccc and 0 or xxx always returns xxx.

Pyth, 7 bytes

*f_I`*Q

Try it online: Demonstration

Explanation

*f_I`*QT)Q   implicit endings, Q=input number
 f      )    find the first number T >= 1, which satisfies:
     *QT        product of Q and T
    `           as string
  _I            is invariant under inversion (=palindrom)
*        Q   multiply this number with Q and print