cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

A000993 Number of distinct quadratic residues mod 10^n; also number of distinct n-digit endings of base-10 squares.

Original entry on oeis.org

1, 6, 22, 159, 1044, 9121, 78132, 748719, 7161484, 70800861, 699869892, 6978353179, 69580078524, 695292156201, 6947835288052, 69465637212039, 694529215501164, 6944974263529141, 69446563720728612, 694457689921141299, 6944497426351013404
Offset: 0

Views

Author

Keywords

Examples

			Any square ends with one of 0, 1, 4, 5, 6, 9, so a(1) = 6.
A square may end with 22 different two-digit combinations: 00, 01, 04, 09, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96. E.g., no number ending with 14 can be square, etc. See also A075821, A075823.
The finite sequence A122986 has a(3) = 159 terms. - _Reinhard Zumkeller_, Mar 21 2010
		

References

  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover Publ., 2nd Ed., NY, 1966, Chapter XV, 'On The Square', p. 139.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Magma
    [1] cat [(83 + 27*(-1)^n + 9*2^(1 + n) + (-1)^n*2^(2 + n) + 9*5^(2 + n) + (-1)^n*5^(2 + n) + 2^(1 + n)*5^(2 + n))/ 72: n in [0..20]]; // Vincenzo Librandi, Mar 29 2012
    
  • Maple
    -(-6+38*z+241*z^2-594*z^3-1285*z^4+1600*z^5+1500*z^6)/((-1+z)*(5*z-1)*(2*z+1)*(2*z-1)*(5*z+1)*(10*z-1)*(z+1)); #  Bruno Salvy
  • Mathematica
    a[n_] := (83 - 27*(-1)^n + 9*2^(n) - (-1)^n*2^(1 + n) + 9*5^(1 + n) - (-1)^n*5^(1 + n) + 2^(n)*5^(1 + n))/72; Table[ Floor[ a[n]], {n, 0, 20}]
    (* Or *) a[0] = 1; a[1] = 6; a[2] = 22; a[3] = 159; a[4] = 1044; a[5] = 9121; a[6] = 78132; a[7] = 748719; a[8] = 7161484; a[n_] := 130 a[n - 2] - 3129 a[n - 4] + 13000 a[n - 6] - 10000 a[n - 8]; Table[ a[n], {n, 0, 20}]
    (* Or *) CoefficientList[ Series[(1 - 4*x - 68*x^2 + 59*x^3 + 723*x^4 - 5*x^5 - 1700*x^6 - 500*x^7)/(1 - 10*x - 30*x^2 + 300*x^3 + 129*x^4 - 1290*x^5 - 100*x^6 + 1000*x^7), {x, 0, 20}], x] (* Robert G. Wilson v, Nov 27 2004 *)
    LinearRecurrence[{10,30,-300,-129,1290,100,-1000},{1,6,22,159,1044,9121,78132,748719},20] (* Harvey P. Dale, Dec 17 2017 *)
  • Python
    print([(2 + 2**n // 6) * (1 + 5**(n+1) // 12) if n else 1 for n in range(21)]) # Nick Hobson, Mar 10 2024

Formula

a(n) = floor( (83 - (-1)^n*(27 + 2^(n+1) + 5^(n+1)) + 9*2^n + (9 + 2^n)*5^(n+1)) / 72 ).
a(n+8) = 130 a(n+6) - 3129 a(n+4) + 13000 a(n+2) - 10000 a(n) for n >= 1.
G.f.: (1 - 4*x - 68*x^2 + 59*x^3 + 723*x^4 - 5*x^5 - 1700*x^6 - 500*x^7)/(1 - 10*x - 30*x^2 + 300*x^3 + 129*x^4 - 1290*x^5 - 100*x^6 + 1000*x^7).

A046638 Number of cubic residues mod 10^n, or number of distinct n-digit endings of cubes.

Original entry on oeis.org

1, 10, 63, 505, 5050, 47899, 466237, 4662370, 46308087, 461504593, 4615045930, 46111077091, 460913873941, 4609138739410, 46086465166623, 460840040641225, 4608400406412250, 46083388790070379, 460830811531341997, 4608308115313419970, 46083004243912737927
Offset: 0

Views

Author

Keywords

Examples

			a(1)=10 because a cube may end with any digit (10 possible combinations); a(2)=63 because a cube may end with 63 2-digit combinations (including leading zeros).
A cube may end with 63 different 2-digit combinations: 00, 01, 03, 04, 07, 08, 09, 11, 12, 13, 16, 17, 19, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 36, 37, 39, 41, 43, 44, 47, 48, 49, 51, 52, 53, 56, 57, 59, 61, 63, 64, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 81, 83, 84, 87, 88, 89, 91, 92, 93, 96, 97, 99. Numbers ending with 14 say cannot be cubes. See also A075821, A075823. - _Zak Seidov_, Oct 18 2002
		

Crossrefs

Programs

  • PARI
    a(n)=(5^(n+2)+30)\31*((4<Charles R Greathouse IV, Jan 03 2013

Formula

a(n) = A046530(10^n) = A046630(n)*A046633(n). - R. J. Mathar, Feb 28 2011
a(n) ~ 100/217 * 10^n, so large terms start 460829493.... - Charles R Greathouse IV, Jan 03 2013
G.f.: -(10000*x^9+9000*x^8-5130*x^6-2357*x^5+259*x^3+37*x^2-1) / ((x-1)*(2*x-1)*(5*x-1)*(10*x-1)*(x^2+x+1)*(25*x^2+5*x+1)*(4*x^2+2*x+1)). - Alois P. Heinz, Jan 03 2013

Extensions

Edited by N. J. A. Sloane, Oct 19 2008

A320775 a(n) is the least exponent k greater than 1 such that prime(n)^k starts and ends in prime(n).

Original entry on oeis.org

21, 41, 24, 33, 171, 361, 461, 471, 1281, 1091, 231, 221, 236, 61, 861, 2761, 241, 546, 3261, 1991, 6081, 421, 9541, 5731, 4461, 1621, 21501, 10381, 5051, 1301, 16301, 30051, 18601, 13601, 3171, 8991, 7561, 3201, 33501, 8701, 17351, 5601, 13551, 901, 10301, 871
Offset: 1

Views

Author

Paolo P. Lava, Dec 03 2018

Keywords

Comments

a(n) always exists. Let p be a prime other than 2 or 5, and m its length in base 10. Let r be the multiplicative order of p mod 10^m. Then p^k ends in p if and only if k-1 is a multiple of r. p^(j*r+1) starts with p if and only if for some integer s, s + log_10(p)) <= (j*r+1)*log_10(p) < s + frac(log_10(p+1)). This is true for some j because r*log_10(p) is irrational and the fractional parts of the multiples of an irrational number are dense in [0,1]. - Robert Israel, Dec 12 2018
If all integers are considered instead of only primes, not all of them can satisfy the requirement. For instance see A075823 for two digits numbers.
Record values beyond 10^5 are: a(51) = 138801, a(74) = 193701, a(88) = 1766101. Also, a(98) = 282076 and a(100) = 438501 would be record values if not preceded by a(88). - M. F. Hasler, Dec 14 2018

Examples

			2^21 = 2097152 and 21 is the least exponent;
3^41 = 36472996377170786403 and 41 is the least exponent.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p, k,m,q,r;
      p:= ithprime(n);
      m:= ilog10(p)+1;
      q:= numtheory:-order(p,10^m);
      for k from q+1 by q do
        r:= p^k;
        if p = floor(r/10^(ilog10(r)+1-m))
          then return k
        fi;
      od
    end proc:
    f(1):= 21: f(3):= 24:
    map(f, [$1..50]); # Robert Israel, Dec 12 2018
  • Mathematica
    a[p_] := Module[{d=IntegerDigits[p]}, nd=Length[d];k=2; While[IntegerDigits[p^k][[1;;nd]] != d || IntegerDigits[p^k][[-nd;;-1]] != d, k++]; k]; a/@Prime@Range@10 (* Amiram Eldar, Dec 10 2018 *)
  • PARI
    isokd(d, dpk) = {for (i=1, #d, if (dpk[i] != d[i], return (0));); return (1);}
    isok(p, k) = {my(dpk=digits(p^k), d = digits(p)); if (!isokd(d, dpk), return (0)); isokd(Vecrev(d), Vecrev(dpk));}
    a(n) = {my(k=2, p = prime(n)); while (!isok(p, k), k++); k;} \\ Michel Marcus, Dec 10 2018
    
  • PARI
    apply( {A320775(n, d=logint(n=prime(n), 10)+1, K=if(n>5||n==3,znorder(Mod(n, 10^d)),n+18), f(x)=x\10^(logint(x, 10)+1-d))=forstep(k=1+K,oo,K, n==f(n^k)&&return(k))}, [1..20]) \\ Define A320775 & test it via apply(). - M. F. Hasler, Dec 10 2018
Showing 1-3 of 3 results.