This site is supported by donations to The OEIS Foundation.

# M. F. Hasler/Truncated squares

Following http://list.seqfan.eu/pipermail/seqfan/2012-January/016279.html here's a table of sequences related to squares which remain squares when the rightmost digit is dropped, in several bases. See also the Index_to_OEIS:_Section_Sq#sqtrunc.

## Contents

### Synoptic table

b a=sqrt(c) c=a² s=[c\b]=r² r=sqrt(c\b) comments
2 A001541 A055792 A084703 A001542 A204574-A204577 = these written in binary
3 A001075 A055793 A098301 A001353
4 A004275 A055808 A000290 A000027
5 A204520 A055812 A203719 A204521
6 A204518 A055851 A204573 A204519
7 A204516 A055859 A204513 A204517
8 A204514 A055872 A204504 A204512
9 A204502 A204503 (A000290) A028310 = A000027 except for a(0)=1; A290 = squares
10   A031149 A023110 A202303 A031150

## Base 10

```A023110 = Squares which remain squares when the last digit is removed = A031149^2
= 0, 1, 4, 9, 16, 49, 169, 256, 361, 1444, 3249, 18496, 64009, 237169, 364816, 519841, 2079364, ...
```
```A031149 (= A204142) = square root of A023110 = floor[a(n)^2/10] is a square.
= 0, 1, 2, 3, 4, 7, 13, 16, 19, 38, 57, 136, 253, 487, 604, 721, 1442, 2163, 5164, ...
```
```A202303 = A023110 with last digit truncated = floor(A023110/10)
= [0,] 0, 0, 0, 1, 4, 16, 25, 36, 144, 324, 1849, 6400, 23716, 36481, 51984, 207936, 467856, ...
```
```A031150 = [0,0,0,0,] 1, 2, 4, 5, 6, 12, 18, 43, 80, 154, 191, 228, 456, 684, 1633, 3038, 5848, 7253, 8658,...
= square root of A202303
```

```A030686 = A030687(n)^2 = Smallest nontrivial extension of n^2 which is a square.
```

## Other bases

In other bases, one can define the analog sequences, and there can be added the same 4 sequences written in the corresponding base.

So we have:

### base 9

Actually the problem is a bit degenerate for b=9: The squares with final digit dropped are essentially all squares.

```A204502 = Numbers such that floor[a(n)^2 / 9] is a square.
= 0, 1, 2, 3, 4, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, ...
```

The squares are in A204503. The squares with last base-9 digit dropped in A204504 (-> A000290 (the squares), without initial duplicates), and the square roots of the latter in A028310 (also w/o duplicates).

```A204503 = Squares n^2 such that floor[n^2 / 9] is again a square   = A204502(n)^2
= 0, 1, 4, 9, 16, 36, 81, 144, 225, 324, 441, 576, 729, 900, 1089, 1296, 1521, 1764, 2025, 2304, 2601, ...
```
```A028310 (= Expansion of (1 - x + x^2) /(1 - x)^2 in powers of x) = sqrt( floor[ A204502(n+2)^2 / 9]  )
= [0, 0, 0], 1, 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,
```

### base 8

```A204514 = Numbers such that floor[a(n)^2 / 8] is again a square.
= 0, 1, 2, 3, 6, 17, 34, 99, 198, 577, 1154, 3363, 6726, 19601, 39202, 114243, 228486, 665857,...
```

Cf. A023110 (base 10), A204502 (base 9); A055792 (base 2), A055793 (base 3).

```A055872 = a(n) and floor[a(n)/8] are both squares.   a(n)=A204514(n)^2.
= 0, 1, 4, 9, 36, 289, 1156, 9801, 39204, 332929, 1331716, 11309769, 45239076, 384199201, 1536796804, ...
```

Base-8 analogue of A055792 (base 2), A055793 (base 3), A055808 (base 4), A055812 (base 5), A055851 (base 6), A055859 (base 7), A204503 (base 9) and A023110 (base 10).

```A204512 = Square roots of [A055872/8].
= 0, 0, 0, 1, 2, 6, 12, 35, 70, 204, 408, 1189, 2378, 6930, 13860, 40391, 80782, 235416, 470832, 1372105,...
```
```A204504 = A204512(n)^2 = floor[A055872(n)/8]: Squares such that appending some digit in base 8 yields another square.
= 0, 0, 0, 1, 4, 36, 144, 1225, 4900, 41616, 166464, 1413721, 5654884, 48024900, 192099600, 1631432881,
```

### base 7

```A204516 = Numbers such that floor[a(n)^2 / 7] is a square = sqrt( A055859 )
= 0, 1, 2, 3, 4, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, ...
```

Cf. A031149 (base 10), A204502 (base 9), A204514 (base 8), A204518 (base 6), A004275=sqrt(A055808) (base 4), A001075=sqrt(A055793) (base 3), A001541=sqrt(A055792) (base 2).

```A055859 = a(n) and floor[a(n)/7] are both squares; i.e. squares which remain squares when written in base 7 and last digit is removed.
= 0, 1, 4, 9, 64, 256, 2025, 16129, 64516, 514089, 4096576, 16386304, 130576329, 1040514049,...
```
```A204517 = sqrt( floor[A204516(n)^2 / 7] )
= 0, 0, 0, 1, 3, 6, 17, 48, 96, 271, 765, 1530, 4319, 12192, 24384, 68833, 194307, ...
```
```A204513 = A204517(n)^2 = floor[A055859(n)/7]: Squares which written in base 7, with some digit appended, yield another square.
= 0, 0, 0, 1, 9, 36, 289, 2304, 9216, 73441, 585225, 2340900, 18653761, 148644864, 594579456, 4737981889, 37755210249, ...
```

### base 6

```A204518 = Numbers such that floor[a(n)^2 / 6] is a square = sqrt(A055851(n)).
= 0, 1, 2, 3, 5, 10, 27, 49, 98, 267, 485, 970, 2643, 4801, 9602, 26163, 47525, 95050, 258987, 470449,...
```
```A055851 = a(n) and floor[a(n)/6] are both squares; i.e. squares which remain squares when written in base 6 and last digit is removed.
= 0, 1, 4, 9, 25, 100, 729, 2401, 9604, 71289, 235225, 940900, 6985449, 23049601, 92198404, ...
```
```A204519 = Square root of floor[A055851(n)/6].
= 0, 0, 0, 1, 2, 4, 11, 20, 40, 109, 198, 396, 1079, 1960, 3920, 10681, 19402, 38804, 105731, 192060, ...
```
```A204573 = squares of A204519 = truncated squares A055851
= 0, 0, 0, 1, 4, 16, 121, 400, 1600, 11881, 39204, 156816, 1164241, 3841600, 15366400, ...
```

### base 5

```A204520 = Numbers such that floor[a(n)^2 / 5] is a square.
= 0, 1, 2, 3, 7, 9, 18, 47, 123, 161, 322, 843, 2207, 2889, 5778, 15127, 39603, 51841, 103682, 271443, ...
```
```A055812 = a(n) and floor[a(n)/5] are both squares = A204520 ^2
= 0, 1, 4, 9, 49, 81, 324, 2209, 15129, 25921, 103684, 710649, 4870849, 8346321, 33385284, 228826129, ...
```

For analogs in other bases see A055792 (base 2), A055793 (base 3), A055808 (base 4), A055851 (base 6), A204517 (base 7), A204515 (base 8), A204503 (base 9) and A023110 (base 10).

```A204521 = Square root of floor[A055812(n) / 5]
= 0, 0, 0, 1, 3, 4, 8, 21, 55, 72, 144, 377, 987, 1292, 2584, 6765, 17711, 23184, 46368, 121393,  317811,...
```
```A203719 = squares of A204521 = truncated squares A055812
= 0, 0, 0, 1, 9, 16, 64, 441, 3025, 5184, 20736, 142129, 974169, 1669264, 6677056, ...
```

### base 4

```A004275 = sqrt(A055808) = 1 together with nonnegative even numbers.
= 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50,
```
```A055808 = a(n) and floor[a(n)/4] are both squares
= 0, 1, 4, 16, 36, 64, 100, 144, 196, 256, 324, 400, 484, 576, 676, 784, 900, 1024, 1156, 1296, 1444,
```

Here, as for b=9, [A055808/2] consists in all squares.

### base 3

```A001075 = sqrt(A055793) = numbers such that floor[a(n)^2/3] is a square
= [0,]	1, 2, 7, 26, 97, 362, 1351, 5042, 18817, 70226, 262087, 978122, 3650401, 13623482, 50843527,
```
```A055793 = Numbers n such that n and floor[n/3] are both squares; i.e. squares which remain squares when written in base 3 and last digit is removed.
= 0, 1, 4, 49, 676, 9409, 131044, 1825201, 25421764, 354079489, 4931691076, 68689595569, 956722646884, ...
```
```A098301 = [A055793 / 3] = Member r=16 of the family of Chebyshev sequences S_r(n) defined in A092184.
= [0,]	0, 1, 16, 225, 3136, 43681, 608400, 8473921, 118026496, 1643897025, 22896531856, ...
```
```A001353 = sqrt( A098301 ) :	a(n) = 4*a(n-1)-a(n-2) with a(0) = 0, a(1) = 1.
= [0,] 0, 1, 4, 15, 56, 209, 780, 2911, 10864, 40545, 151316, 564719, 2107560, 7865521, 29354524, 109552575, ...
```

### base 2

```A001541 = sqrt(A055792) (= a(0) = 1, a(1) = 3; for n > 1, a(n) = 6a(n-1) - a(n-2). )
=  1, 3, 17, 99, 577, 3363, 19601, 114243, 665857, 3880899, 22619537, 131836323, 768398401, 4478554083,
```
```A055792 = a(n) and floor[a(n)/2] are both squares; i.e. squares which remain squares when written in base 2 and last digit is removed.
= 0, 1, 9, 289, 9801, 332929, 11309769, 384199201, 13051463049, 443365544449, 15061377048201, ...
```
```A084703 = floor[A055792/2] = A001542^2 (= Squares n such that 2n+1 is also a square)
= [0,] 0, 4, 144, 4900, 166464, 5654884, 192099600, 6525731524, 221682772224, 7530688524100, ...
```
```A001542 = sqrt(A084703) (= a(n) = 6a(n-1) - a(n-2).)
= [0,] 0, 2, 12, 70, 408, 2378, 13860, 80782, 470832, 2744210, 15994428, 93222358, 543339720, 3166815962, ...
```
```A204574, A204575, A204576, A204577 = A001541, A055792, A084703, A001542 written in binary.
```

## PARI/gp code

Any such sequences are most easily computed by checking for the a(n)s such that [a(n)²/b] is again a square:

```b=3 /* the "base" */; N=50 /* max.# of terms */; for(n=0,1e9, issquare(n^2\b)|next; print1( n ",");N--|break)
```

and in the print1() command, n can successively be replaced by n^2, (n^2\b) and sqrtint(n^2\b), possibly wrappend into the base-b display command, e.g., base( sqrtint(n^2\b) ,b,1) in my private library).

For sequences that grow fast, the 3 lines can be completed in a more efficient way, if one of the sequences admits an easy-to-find o.g.f.. Then say

```gf = ggf([     ])                  /* paste data inside the [...] */
a = Vec( gf + O(x^50)              /* to get 50 terms */ )
apply( n -> sqrtint(n^2\b), a )    \\ or the like, depending on what you have & what you want.
```

A function that comes handy to prettyprint the GF (because PARI writes polynomials in order of decreasing powers)
[any better idea is strongly welcomed !]

```pgf( f )=print("(", numerator(f)+O(x^99) ,")/(", denominator(f)+O(x^99) ,")")
```

Then of course you'll have to delete the "O(...)" by hand. More sophisticated: use

```p( P )=concat( vecextract( Vec(Str( P+O(x^99) )), "..-11"))
pgf( f )=print("(", p(numerator(f)) ,")/(", p(denominator(f)) ,")")
```