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.

A357299 a(n) is the number of divisors of n whose first digit equals the first digit of n.

This page as a plain text file.
%I A357299 #28 Sep 24 2022 08:16:19
%S A357299 1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,1,2,1,
%T A357299 1,2,1,1,2,2,1,1,1,2,1,1,1,2,1,2,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,2,1,1,
%U A357299 1,2,1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,2,3
%N A357299 a(n) is the number of divisors of n whose first digit equals the first digit of n.
%C A357299 Similar to A330348, but with last digit.
%C A357299 a(n) >= 1 because there is always a divisor that fits: n.
%C A357299 a(n) >= 2 for n>1 in A131835.
%H A357299 Michel Marcus, <a href="/A357299/b357299.txt">Table of n, a(n) for n = 1..10000</a>
%e A357299 The divisors of 26 that start in 2 are 2 and 26, so a(26) = 2.
%t A357299 f[n_] := IntegerDigits[n][[1]]; a[n_] := DivisorSum[n, 1 &, f[#] == f[n] &]; Array[a, 100] (* _Amiram Eldar_, Sep 23 2022 *)
%o A357299 (PARI) a(n) = my(fd=digits(n)[1]); sumdiv(n, d, digits(d)[1] == fd); \\ _Michel Marcus_, Sep 23 2022
%o A357299 (Python)
%o A357299 from sympy import divisors
%o A357299 def a(n): f = str(n)[0]; return sum(1 for d in divisors(n) if str(d)[0]==f)
%o A357299 print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Sep 23 2022
%Y A357299 Cf. A000030, A131835, A330348, A356549, A357300.
%K A357299 nonn,base
%O A357299 1,10
%A A357299 _Bernard Schott_, Sep 23 2022