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.

A360108 Sum of squares of digits of primorial base expansion of n.

This page as a plain text file.
%I A360108 #15 Mar 06 2024 01:02:29
%S A360108 0,1,1,2,4,5,1,2,2,3,5,6,4,5,5,6,8,9,9,10,10,11,13,14,16,17,17,18,20,
%T A360108 21,1,2,2,3,5,6,2,3,3,4,6,7,5,6,6,7,9,10,10,11,11,12,14,15,17,18,18,
%U A360108 19,21,22,4,5,5,6,8,9,5,6,6,7,9,10,8,9,9,10,12,13,13,14,14,15,17,18,20,21,21,22
%N A360108 Sum of squares of digits of primorial base expansion of n.
%H A360108 Antti Karttunen, <a href="/A360108/b360108.txt">Table of n, a(n) for n = 0..30030</a>
%H A360108 <a href="/index/Pri#primorialbase">Index entries for sequences related to primorial base</a>.
%F A360108 a(n) = A090885(A276086(n)).
%F A360108 For all n >= 0, a(2n+1) = 1 + a(2n).
%e A360108 5 in primorial base (A049345) is written as "21" (because 5 = 2*2 + 1*1), therefore a(5) = 2^2 + 1^2 = 5.
%e A360108 23 in primorial base is written as "321" (because 23 = 3*6 + 2*2 + 1*1), therefore a(23) = 3^2 + 2^2 + 1^2 = 14.
%e A360108 24 in primorial base is written as "400" (because 24 = 4*6 + 0*2 + 0*1), therefore a(24) = 4^2 = 16.
%t A360108 a[n_] := Module[{k = n, p = 2, s = 0, r}, While[{k, r} = QuotientRemainder[k, p]; k != 0 || r != 0, s += r^2; p = NextPrime[p]]; s]; Array[a, 100, 0] (* _Amiram Eldar_, Mar 06 2024 *)
%o A360108 (PARI) A360108(n) = { my(s=0, p=2, d); while(n, d = (n%p); s += d^2; n = (n-d)/p; p = nextprime(1+p)); (s); };
%Y A360108 Cf. A002110 (positions of 1's), A049345, A090885, A276086, A276150.
%Y A360108 Cf. also A003132.
%K A360108 nonn,base,easy,look
%O A360108 0,4
%A A360108 _Antti Karttunen_, Jan 28 2023