A really weird kind of number

About two months ago, I was randomly using my calculator to find a bunch of squares. Then, I noticed something a bit odd. One of the squares was 69696, and I was pretty sure that its square root wasn't a palindrome. When I square-rooted it, I got 264. By now I was really interested. I started experimenting to see if I could find other non-palindromes with palindromic squares, and I found 4!

26, whose square is 676. 264, whose square is 69696. 2285, whose square is 5221225. 2636, whose square is 6948496.

I checked all the way up to 7000^2, but didn't find any more. Maybe I could try writing some code to find them. If you find any, can you put them in the comments? Extra bonus if they're prime!

Note by Kent Hitchborn
2 weeks, 6 days ago

No vote yet
1 vote

  Easy Math Editor

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

  • Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
  • Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
  • Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
  • Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}

Comments

Sort by:

Top Newest

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
n       n^2
1       1
2       4           2 is PRIME!
3       9           3 is PRIME!
11      121         11 is PRIME!
22      484
26      676
101     10201           101 is PRIME!
111     12321
121     14641
202     40804
212     44944
264     69696
307     94249           307 is PRIME!
836     698896
1001        1002001
1111        1234321
2002        4008004
2285        5221225
2636        6948496
10001       100020001
10101       102030201
10201       104060401
11011       121242121
11111       123454321
11211       125686521
20002       400080004
20102       404090404
22865       522808225
24846       617323716
30693       942060249
100001      10000200001
101101      10221412201
110011      12102420121
111111      12345654321
200002      40000800004
798644      637832238736
1000001     1000002000001
1001001     1002003002001
1002001     1004006004001
1010101     1020304030201
1011101     1022325232201
1012101     1024348434201
1042151     1086078706801
1100011     1210024200121
1101011     1212225222121
1102011     1214428244121
1109111     1230127210321
1110111     1232346432321
1111111     1234567654321
1270869     1615108015161
2000002     4000008000004
2001002     4004009004004
2012748     4051154511504
2294675     5265533355625
3069307     9420645460249
(and most likely infinitely many more solutions...)

Pi Han Goh - 2 weeks, 6 days ago

Log in to reply

I believe the problem required the square roots to be non-palindromic. Filtering for this would result in the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
n       n^2
2       4           2 is PRIME!
3       9           3 is PRIME!
26      676
264     69696
307     94249           307 is PRIME!
836     698896
2285        5221225
2636        6948496
22865       522808225
24846       617323716
30693       942060249
798644      637832238736
1042151     1086078706801
1270869     1615108015161
2012748     4051154511504
2294675     5265533355625
3069307     9420645460249

David Stiff - 2 weeks, 5 days ago

Log in to reply

As always, It was so satisfying seeing the output😄

Agent T - 2 weeks, 3 days ago

Log in to reply

11
24
39
11121
22484
26676
10110201
11112321
12114641
20240804
21244944
26469696
30794249
836698896
10011002001
11111234321
20024008004
22855221225
26366948496
10001100020001
10101102030201
10201104060401
11011121242121
11111123454321
11211125686521
20002400080004
20102404090404
22865522808225
24846617323716
30693942060249
10000110000200001
10110110221412201
11001112102420121
11111112345654321
20000240000800004
798644637832238736
10000011000002000001
10010011002003002001
10020011004006004001
10101011020304030201
10111011022325232201
10121011024348434201
10421511086078706801
11000111210024200121
11010111212225222121
11020111214428244121
11091111230127210321
11101111232346432321
11111111234567654321
12708691615108015161
20000024000008000004
20010024004009004004
20127484051154511504
22946755265533355625
30693079420645460249
10000001100000020000001
10011001100220141022001
10100101102012040210201
10111101102234363432201
11000011121000242000121
11011011121242363242121
11100111123212464212321
11111111123456787654321
11129361123862676268321
12028229144678292876441
12866669165551171155561
20000002400000080000004
30001253900075181570009

Agent T - 2 weeks, 3 days ago

Log in to reply

64030648 4099923883299904

110091011 12120030703002121

111091111 12341234943214321 (this one is very interesting because 1109111 also is in the sequence so maybe we can make one generator using this?)

306930693 94206450305460249

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

Oh great idea! But how?

Agent T - 2 weeks, 3 days ago

Log in to reply

@Agent T I thought the pattern repeats it doesn’t seem too, just a coincidence, it messes up the middle part, the ends are palindromic, it’s kinda semi palindromic

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez Oh that's sad :/

Agent T - 2 weeks, 3 days ago

Log in to reply

I'm starting a new thread bcz that one was getting thinner

@Jason Gomez Here's what we are reqd to do in the program:

Ok lemme strt frm the starting ,

Step 1: know that the number of digits in a number can be calculated by log10n+1\boxed{⌊log_{10}n⌋+1} here's the logic behind it and do lemme know if u don't understand it.

step 2: we have to create a palindromic square, so for that we will first take a no. (n) then reverse it(save it as r) and at last concatenate them to get the palindromes by setting a loop.

Step 3: filter out squares from the above palindrome set.

Step 4: filter out palindromic squares whose squareroots aren't palindromes.

Hope you got it

Regards, Agent T

Agent T - 2 weeks, 3 days ago

Log in to reply

So you are trying to get palindromes first then take the square root and then check whether the resulting number is non palindromic, effectively going the opposite way which should speed up things, that’s a good method, this method only gets even number of digits palindromic square numbers, a little tweak and odd digits should be done too,

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez I always strt with a longer but easier way then modify to make it more efficient, and yes you're correct about the nos.having odd no of digits (n.h.o.n.d) But I think if we are able to make one for n.h.e.n.d. then adding a no.in the middle to make it a n.h.o.n.d. would be a piece of cake :)

Agent T - 2 weeks, 2 days ago

Log in to reply

Few things to note, numbers ending in zero can not be palindromic, after taking root to check whether an integer is formed you can use int(n)==n, works till about n=67000000, so all square palindromes under fourteen digits can be found using this, beyond this requires the remaking of the square root function

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Okay cool I'll keep taht in mind

Agent T - 2 weeks, 2 days ago

Log in to reply

836.0 698896

798644.0 637832238736

64030648.0 4099923883299904

These are the only even palindromic squares I got it (outputted one more after this 100000000.0 9999999999999999 clearly it’s broken)

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Wait for a while my program is almost completed

Agent T - 2 weeks, 2 days ago

Log in to reply

The next question would be to find a generator for this sequence (square root being non palindromic)

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

You are asking for this right?(non palindromic numbers whose squares are palindromic)

26676
26469696
30794249
836698896
22855221225
26366948496
22865522808225
798644637832238736
12708691615108015161
20127484051154511504
22946755265533355625

Agent T - 2 weeks, 3 days ago

Log in to reply

Code for printing the above seq is :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
for n in range(1,10000000):
    t=n**2
    ta=str(t)
    z=len(ta)
    za=z//2
    a=-1
    for A in range(za):
                if ta[A]==ta[a]:
                    A+=1
                    a-=1
                else:
                    break
    else:
            zo=str(n)
            k=len(zo)
            zum=k//2
            c=-1
            for t in range(zum):
                if zo[t]!=zo[c]:
                    t+=1
                    c-=1
                else:
                        break
            else:
                print(zo,ta)

Agent T - 2 weeks, 3 days ago

Log in to reply

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
i=1
while True:
    st=str(i**2)
    li=list(st)
    if li==li[::-1]:
        st=str(i)
        li=list(st)
        if li==li[::-1]:
            print(i,"\t",i**2,"palindromic root")
        else:
            print(i,"\t",i**2,"non palindromic root")
    i+=1

Useless Header

This is what I used

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez Yeah this one's more efficient and economical, great job!

but my output is more effective :P\tiny{\text{but my output is more effective :P}}

Agent T - 2 weeks, 3 days ago

Log in to reply

I was not asking this actually, I was asking for a generator, which can find such numbers without brute force

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez An example is the generator for perfect numbers, 2p1(2p1)2^{p-1}(2^p-1) where p and 2p12^p-1 are primes

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez This generator gives all the perfect numbers but a generator doesn’t have to give all the numbers of the sequence intended

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez Dude I understood what y meant ...I was searching for something useful like this and this one's awesome too.

Edit:check out this prog For reversing the digits of a number


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import math
n=int(input('ent'))
z=math.ceil(math.log10(n))
best=0
for t in range(0,z):
    a=10**(z-t-1)
    b=math.floor(n/10**t)
    c=math.floor(b/10)
    TA=a*(b-(10*c))
    best=best+TA
print(best)

Agent T - 2 weeks, 3 days ago

Log in to reply

@Agent T Can you give a hint on what the program should be doing, I really don’t want to find out what those nine variables should\tiny\text{should} stand for

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez Edit edit EDIT: I started a new thread and mentioned u twice, go check that out! frmla for rev the digits of a no. frmla for rev the digits of a no.

Agent T - 2 weeks, 3 days ago

Log in to reply

@Agent T I just wanted to know something, do you have a phobia towards lists, strings, etc?

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Yes I'm very scared of lists and tuples, Man! my cs.teacher was so worried during my practicals, that she started having a panick attack...-_- don't mess with me kiddo

Agent T - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Anyway this what I did for the even palindrome

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
i=1
while True:
    if i%10==0:
        i+=1
    li=list(str(i))
    li.extend(li[::-1])
    palsq=int("".join(li))
    if int(palsq**0.5)==palsq**0.5:
        print(palsq**0.5,palsq)
    i+=1

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Even better than mine(which is still in progress), great work!

Agent T - 2 weeks, 2 days ago

Log in to reply

@Agent T The odd boy, comparatively much slower due to adding in that middle digit

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
i=1
while True:
    li=list(str(i))
    for z in range(0,10):
        ti=li[::]
        ti.extend(li[::-1])
        ti.insert(int(len(ti)/2),str(z))
        palsq=int("".join(ti))
        if int(palsq**0.5)==palsq**0.5:
            if not list(str(int(palsq**0.5)))==list(str(int(palsq**0.5)))[::-1]:
                print(palsq**0.5,palsq)
    i+=1

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez It's AwEsOmE !! just edit the else part a bit to make it more presentable

Agent T - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez It broke before it found new ones, have to remake square root function if we need to find more

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez You're the kinda person who asks a ques, manages to find the ans and then flex it on the person whom u asked right ??

Agent T - 2 weeks, 2 days ago

Log in to reply

@Agent T Nope genuinely saw the problem and have/had no solution to it (I don’t want to make a square root function, it’s gonna be a pain)

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez My exams got cancelled yesterday, so I can do that (maybe)

Agent T - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Mine too sadly, now I have total uncertainty on how they will grade me

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Same ,btw we do have a sqrt func in math lib of python...will that work?

Agent T - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez This is the frequency of the middle digit, includes palindromic root too, I thought some numbers might not be possible but everything is :(

11
23
32
49
55
68
76
89
92

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez Oh....btw may I know these "seeming not possible" nos that are possible?

Agent T - 2 weeks, 2 days ago

Log in to reply

@Agent T Maybe you wanted to actually divide the 2.303 rather than multiply right

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez I suggest replacing the 2.303 with math.log(10) or changing the base altogether by doing math.log(n,10)

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez I wanted to change the ln to log10\log_{10} ..okay I'll update it

Agent T - 2 weeks, 3 days ago

Log in to reply

@Agent T Why have you added one to z to subtract one from it everywhere required

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez Oh yeah I coul d have just written z :P guess I got too involved in the research

Agent T - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez No no it was correct, actually z was storing the no.of digits of the reqd no.

Agent T - 2 weeks, 2 days ago

Log in to reply

@Agent T The function sum should used on an iterable like a list or a set

Jason Gomez - 2 weeks, 3 days ago

Log in to reply

@Jason Gomez Okay cool, thanks for clarifying that one lol

Agent T - 2 weeks, 3 days ago

Log in to reply

New thread, I found out that square root function is still enough accurate though, if it makes a mistake then it’s easy to spot because it will be either one number below or above, and by comparing the root and square’s last digit, you can find whether it’s right or not

Jason Gomez - 2 weeks, 2 days ago

Log in to reply

@Jason Gomez That math sqrt one right? That's grt!

Agent T - 2 weeks, 2 days ago

Log in to reply

×

Problem Loading...

Note Loading...

Set Loading...