A140434 Number of new visible points created at each step in an n X n grid.
1, 2, 4, 4, 8, 4, 12, 8, 12, 8, 20, 8, 24, 12, 16, 16, 32, 12, 36, 16, 24, 20, 44, 16, 40, 24, 36, 24, 56, 16, 60, 32, 40, 32, 48, 24, 72, 36, 48, 32, 80, 24, 84, 40, 48, 44, 92, 32, 84, 40, 64, 48, 104, 36, 80, 48, 72, 56, 116, 32, 120
Offset: 1
Keywords
Examples
G.f. = x + 2*x^2 + 4*x^3 + 4*x^4 + 8*x^5 + 4*x^6 + 12*x^7 + 8*x^8 + 12*x^9 + ...
References
- C. Reutenauer, From Christoffel words to Markoff numbers, Oxford University Press, 2019.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
Programs
-
Haskell
a140434 n = a140434_list !! (n-1) a140434_list = 1 : zipWith (-) (tail a018805_list) a018805_list -- Reinhard Zumkeller, May 04 2014
-
Mathematica
f[n_] := FoldList[Plus, 1, 2 Array[EulerPhi, n, 2]] // Differences // Prepend[#, 1]& a[ n_] := If[ n < 3, Max[0, n], Sum[ MoebiusMu[d] (2 n/d - 1 - Mod[n/d, 2]), {d, Divisors@n}]]; (* Michael Somos, Jul 24 2015 *)
-
PARI
{a(n) = if( n<3, max(0, n), sumdiv(n, d, moebius(d) * (2*n/d - 1 - (n/d)%2)))}; /* Michael Somos, Jul 24 2015 */
-
PARI
my(N=66, x='x+O('x^N)); Vec(sum(k=1, N, moebius(k)*x^k*(1+x^k)/(1-x^k)^2)) \\ Seiichi Manyama, May 24 2021
-
Python
from sympy import totient def A140434(n): return totient(n)<<1 if n>1 else 1 # Chai Wah Wu, May 09 2025
Formula
a(n) = 2*phi(n), where phi is Euler's phi function, A000010, for n >= 2.
Sum_{k=1..n} a(k)*floor(n/k) = n^2. - Benoit Cloitre, Nov 09 2016
G.f.: Sum_{k>=1} mu(k) * x^k * (1 + x^k)/(1 - x^k)^2. - Seiichi Manyama, May 24 2021
Extensions
Mathematica simplified by Jean-François Alcover, Jun 06 2013
Comments