A075759 Duplicate of A000993.
1, 6, 22, 159, 1044, 9121, 78132, 748719, 7161484, 70800861, 699869892, 6978353179
Offset: 0
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
fQ[n_] := IntegerQ[Sqrt[n*10^Floor[1 + Log10[n + 1]] + n + 1]]; (* Robert G. Wilson v, Dec 27 2017 *)
lista(nn) = forstep(n=183, nn, [3, 5, 7, 5, 3, 1, 4, 7, 5, 3, 5, 7, 5, 3, 5, 7, 5, 3, 5, 7, 4, 1], my(s = eval(concat(Str(n), Str(n+1)))); if(issquare(s), print1(s, ", "))) \\ Iain Fox, Dec 27 2017
eea(x, y) = my(a=max(x,y), b=min(x,y), s=0, so=1, st, r=b, ro=a, rt, q, t); while(r, q=ro\r; rt=r; r=ro-q*r; ro=rt; st=s; s=so-q*s; so=st); t=(ro-so*a)\b; if(x>y, [so, t], [t, so]) \\ Extended Euclidean Algorithm lista(nn) = my(res=Set(), b, f2, c, s); for(d=3, nn, b=10^d+1; fordiv(b, f, if(f!=1 && f!=b, f2=b/f; if(gcd(f, f2)==1, c=eea(f, f2); if(c[1]<0, s=f*(f2+2*c[1])*f2*(f-2*c[2])+1, s=f*(2*c[1])*f2*(-2*c[2])+1); if(#digits(s)==d*2, res=setunion(res, Set(s))))))); Vec(res) \\ (Will find all values of length nn*2 or shorter) Iain Fox, Oct 16 2021
The last three digits of n^2 can be 000, 001, 236, 241, 996, etc. but not 002, 003, 237, 238, etc.
[n: n in [0..999] | IsSquare(R! n) where R:= ResidueClassRing(1000)]; // Vincenzo Librandi, Dec 29 2019
s:={}: for n from 0 to 999 do s:=s union {n^2 mod 1000}: od: op(s); # Nathaniel Johnston, Jun 22 2011
Union[PowerMod[Range[1000], 2, 1000]] (* Vincenzo Librandi, Dec 29 2019 *)
Any square ends with one of [ 0 ], 1, 4, 5, 6, 9, so a(1) = 5. a(3) = A000993(3) - a(2) - #{100, 104, 201, 204, 209, 304, 400, 401, 404, 409, 500, 504, 600, 601, 604, 609, 704, 801, 804, 809, 900, 904} = 159 - 18 - 22 = 119, cf. A122986. - _Reinhard Zumkeller_, Mar 21 2010
(* A partly empirical script *) a[n_] := (Clear[qr]; qr[] = False; For[k = 1, k <= 10^n/4, k++, m = PowerMod[k, 2, 10^n]; If[m > 10^(n-1) && FreeQ[IntegerDigits[m], 0], qr[m] = True]]; For[cnt = 0; k = 10^(n-1)+1, k <= 10^n-1, k++, If[qr[k], cnt++]]; cnt); a[1] = 5; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 10}] (* _Jean-François Alcover, Jul 31 2015 *)
from math import isqrt def a(n): suffixes = set() for k in range(isqrt(10 ** (n - 1)) + 1, 10 ** n): kk = k * k s = str(kk)[-n:] if "0" not in s and len(s) >= n: suffixes.add(s) return len(suffixes) print([a(n) for n in range(1, 8)]) # Michael S. Branicky, May 18 2021
From _Danny Rorabaugh_, Dec 15 2015: (Start) The squares of the numbers 0..8 are [0, 1, 4, 9, 16, 25, 36, 49, 64]. Modulo 9, these are [0, 1, 4, 0, 7, 7, 0, 4, 1]. Thus there are a(1) = 4 distinct quadratic residues module 9^1 = 9: 0, 1, 4, and 7. There are a(2) = 31 subwords of y_2 = abacdcaba which occur in y_2 exactly once: [abac, abacd, abacdc, abacdca, abacdcab, abacdcaba, bac, bacd, bacdc, bacdca, bacdcab, bacdcaba, ac, acd, acdc, acdca, acdcab, acdcaba, cd, cdc, cdca, cdcab, cdcaba, d, dc, dca, dcab, dcaba, ca, cab, caba]. (End)
I:=[1, 4, 31]; [n le 3 select I[n] else 9*Self(n-1)+Self(n-2)-9*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Apr 22 2012
CoefficientList[Series[(1-6*x)/((1-x)*(1-9*x)),{x,0,30}],x] (* Vincenzo Librandi, Apr 22 2012 *)
The last digit of a triangular number is one of 0, 1, 3, 5, 6, or 8, so a(1) = 6. (To verify that no number from {2, 4, 7, 9} can be the last digit of a triangular number T, note that 8*T+1, which must be a square, would end with 7, 3, 7, or 3, respectively, but no square ends with 3 or 7.) The 44 two-digit combinations with which a triangular number may end are 00, 01, 03, 05, 06, 10, 11, 15, 16, 20, 21, 25, 26, 28, 30, 31, 35, 36, 40, 41, 45, 46, 50, 51, 53, 55, 56, 60, 61, 65, 66, 70, 71, 75, 76, 78, 80, 81, 85, 86, 90, 91, 95, 96. Of these, there are ten combinations of each of the forms x0, x1, x5, and x6; the other four, which are the only ones that end with a digit other than 0, 1, 5, or 6, are 03, 28, 53, and 78 (i.e., numbers whose residue modulo 25 is 3): . last digit 0 1 2 3 4 5 6 7 8 9 +------------------------------ 0 | 00 01 03 05 06 1 | 10 11 15 16 2 | 20 21 25 26 28 next-to-last 3 | 30 31 35 36 digit 4 | 40 41 45 46 5 | 50 51 53 55 56 6 | 60 61 65 66 7 | 70 71 75 76 78 8 | 80 81 85 86 9 | 90 91 95 96
Comments