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.

A242667 Number of ways of representing n as the sum of one or more consecutive squarefree numbers.

This page as a plain text file.
%I A242667 #28 Feb 07 2023 12:00:27
%S A242667 1,1,2,0,2,2,1,1,0,2,3,0,2,2,1,1,3,1,1,0,3,1,3,2,0,1,1,2,2,1,2,1,2,4,
%T A242667 1,1,1,2,2,1,2,3,2,1,2,2,2,1,1,0,2,1,2,0,4,0,3,2,3,0,3,2,1,1,2,3,2,0,
%U A242667 3,3,3,3,1,1,1,1,2,3,2,2
%N A242667 Number of ways of representing n as the sum of one or more consecutive squarefree numbers.
%H A242667 Robert Israel, <a href="/A242667/b242667.txt">Table of n, a(n) for n = 1..10000</a>
%e A242667 a(6)=2 because n=6 itself is already a squarefree number (sum of 1 term), and 6 can in addition be written as A005117(1)+ A005117(2)+A005117(3), a sum of 3 consecutive squarefree numbers.
%p A242667 A242667 := proc(n)
%p A242667     a := 0 ;
%p A242667     for i from 1 do
%p A242667         if A005117(i) > n then
%p A242667             return a;
%p A242667         end if;
%p A242667         for k from i do
%p A242667             su := add(A005117(s),s=i..k) ;
%p A242667             if su = n then
%p A242667                 a := a+1 ;
%p A242667             elif su > n then
%p A242667                 break;
%p A242667             fi ;
%p A242667         end do:
%p A242667     end do:
%p A242667 end proc:
%p A242667 seq(A242667(n),n=1..80) ; # _R. J. Mathar_, Jun 12 2014
%p A242667 # Alternative:
%p A242667 N:= 1000:# to get the first N entries
%p A242667 A005117:= select(numtheory:-issqrfree,[$1..N]):
%p A242667 M:= nops(A005117);
%p A242667 A:= Array(1..N):
%p A242667 t0:= 0:
%p A242667 for n from 1 to M-1 do
%p A242667   t0:= t0 + A005117[n];
%p A242667   t:= t0;
%p A242667   for i from 1 while t <= N do
%p A242667      A[t] := A[t]+1;
%p A242667      if n+i > M then break fi;
%p A242667      t:= t + A005117[n+i]-A005117[i];
%p A242667   od;
%p A242667 od:
%p A242667 seq(A[i],i=1..N); # _Robert Israel_, Jun 25 2014
%t A242667 With[{N = 100}, (* to get the first N entries *)
%t A242667 A005117 = Select[Range[N], SquareFreeQ];
%t A242667 M = Length[A005117];
%t A242667 A = Table[0, {N}];
%t A242667 t0 = 0;
%t A242667 For[n = 1, n <= M-1, n++,
%t A242667    t0 = t0+A005117[[n]];
%t A242667    t = t0;
%t A242667    For[i = 1, t <= N, i++,
%t A242667       A[[t]] = A[[t]]+1;
%t A242667       If[n+i > M, Break[]];
%t A242667       t = t + A005117[[n+i]] - A005117[[i]]]
%t A242667    ]
%t A242667 ];
%t A242667 A (* _Jean-François Alcover_, Feb 07 2023, after _Robert Israel_ *)
%Y A242667 Cf. A005117.
%K A242667 nonn
%O A242667 1,3
%A A242667 _Irina Gerasimova_, May 20 2014