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.

A305461 The number of one-digit numbers, k, in base n such that k^2 and k^3 end in the same digit.

This page as a plain text file.
%I A305461 #49 Mar 04 2025 11:09:49
%S A305461 1,2,2,3,2,4,2,3,4,4,2,6,2,4,4,5,2,8,2,6,4,4,2,6,6,4,4,6,2,8,2,5,4,4,
%T A305461 4,12,2,4,4,6,2,8,2,6,8,4,2,10,8,12,4,6,2,8,4,6,4,4,2,12,2,4,8,9,4,8,
%U A305461 2,6,4,8,2,12,2,4,12,6,4,8,2,10,10,4,2,12,4
%N A305461 The number of one-digit numbers, k, in base n such that k^2 and k^3 end in the same digit.
%C A305461 It appears that a(n) is equal to the number of factors of n, except when n cannot be divided by its multiplicative projection (A230542). - Ian Newman, Jun 01 2018
%C A305461 Number of solutions to x^3 - x^2 == 0 (mod n). - _Andrew Howroyd_, Jul 22 2018
%H A305461 Matthew Scroggs, <a href="/A305461/b305461.txt">Table of n, a(n) for n = 1..1000</a>
%H A305461 Matthew Scroggs, <a href="http://www.mscroggs.co.uk/puzzles/159">Square and cube endings</a>.
%F A305461 Multiplicative with a(p^e) = p^floor(e/2) + 1 for prime p. - _Andrew Howroyd_, Jul 22 2018
%e A305461 In base 4,
%e A305461   0^2 =  0, 0^3 =   0,
%e A305461   1^2 =  1, 1^3 =   1,
%e A305461   2^2 = 10, 2^3 =  20,
%e A305461   3^2 = 21, 3^3 = 123.
%e A305461 Three of these pairs have the same final digit, so a(4)=3.
%t A305461 Table[Count[Range@ n, _?(PowerMod[#, 2, n] == PowerMod[#, 3, n] &)], {n, 85}] (* _Michael De Vlieger_, Jul 30 2018 *)
%t A305461 f[p_, e_] := p^Floor[e/2] + 1; a[n_] := Times @@ f @@@ FactorInteger[n]; a[1] = 1; Array[a, 100] (* _Amiram Eldar_, Sep 07 2023 *)
%o A305461 (Python)
%o A305461 for base in range(1, 101):
%o A305461     n = 0
%o A305461     for j in range(base):
%o A305461         if (j**2)%base == (j**3)%base:
%o A305461             n += 1
%o A305461     print(base, n)
%o A305461 (Haskell)
%o A305461 a305461 n = length $ filter (\i -> (i^3 - i^2) `mod` n == 0) [0..n-1]
%o A305461 -- _Peter Kagey_, Jun 10 2018
%o A305461 (PARI) a(n) = sum(k=0, n-1, mk = Mod(k, n); mk^2 == mk^3); \\ _Michel Marcus_, Jul 03 2018
%o A305461 (PARI) a(n)={my(f=factor(n)); prod(i=1, #f~, my(p=f[i,1], e=f[i,2]); p^(e\2) + 1)} \\ _Andrew Howroyd_, Jul 22 2018
%Y A305461 A034444 is the number of one-digit numbers, k, in base n such that k and k^2 end in the same digit.
%Y A305461 Cf. A230542.
%K A305461 nonn,easy,mult
%O A305461 1,2
%A A305461 _Matthew Scroggs_, Jun 01 2018
%E A305461 a(1) inserted by _Andrew Howroyd_, Jul 22 2018