A378168 a(n) is the number of squares <= 10^n that are not higher powers, i.e., terms of A076467.
2, 6, 24, 87, 292, 959, 3089, 9875, 31410, 99633, 315589, 998889, 3160340, 9996605, 31616816, 99989509, 316209268, 999967330, 3162219896, 9999897769, 31622595517, 99999679010, 316227196708, 999998989804, 3162275866962, 9999996815862, 31622770946248, 99999989953079
Offset: 1
Keywords
Examples
a(1) = 2: squares <= 10 are 2^2 and 3^2; a(2) = 6: 2 squares <= 10 and 5^2, 6^2, 7^2, 10^2, but not 4^2=2^4, 8^2=2^6, and 9^2=3^4; a(3) = 24: 6 squares <= 100 and all squares between 11^2 and 31^2, except for 16^2=2^8, 25^2=5^4, and 27^2=3^6.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..2000
Programs
-
Mathematica
Table[Sum[MoebiusMu[k]*Floor[10^(n/(2k))-1],{k,Floor[Log2[10^n]-1]}],{n,28}] (* James C. McMahon, Nov 21 2024 *)
-
Python
from math import gcd from sympy import integer_nthroot, mobius def A378168(n): return sum(mobius(k)*(integer_nthroot(10**(n//(a:=gcd(n,b:=k<<1))), b//a)[0]-1) for k in range(1, (10**n).bit_length()-1)) # Chai Wah Wu, Nov 20 2024
Formula
a(n) = Sum_{k=1..floor(log_2(10^n)-1)} mu(k)*floor(10^(n/(2k))-1). - Chai Wah Wu, Nov 20 2024
Extensions
a(20) onwards from Chai Wah Wu, Nov 20 2024