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.

A367360 Comma transform of squares.

This page as a plain text file.
%I A367360 #38 Jul 09 2025 05:03:19
%S A367360 1,14,49,91,62,53,64,96,48,11,1,11,41,91,62,52,62,93,43,14,4,14,45,95,
%T A367360 66,56,67,97,48,19,9,11,41,91,61,51,61,91,41,11,1,11,41,91,62,52,62,
%U A367360 92,42,12,2,12,42,92,63,53,63,93,43,13,3,13,43,94,64,54,64,94,44,14,5,15,45,95,65,55,65,96,46,16,6,16,46,97
%N A367360 Comma transform of squares.
%C A367360 To compute the comma transform of a sequence [b,c,d,e,f,...], concatenate the last digit of each term with the first digit of the following term. In other words, these are the numbers formed by the pairs of digits that surround the commas that separate the terms of the original sequence.
%C A367360 The comma transform CT(S) of a sequence S of positive numbers maps S into the set F consisting of finite or infinite sequences of positive numbers each with one or two digits. The inverse comma transform CTi maps an element of F to an element of F.
%C A367360 Inspired by Eric Angelini's A121805.
%H A367360 Michael S. Branicky, <a href="/A367360/b367360.txt">Table of n, a(n) for n = 0..10000</a>
%F A367360 a(n) = 10 * A008959(n) + A002993(n+1). - _Alois P. Heinz_, Nov 22 2023
%e A367360 The squares are 0, 1, 4, 9, 16, 25, ..., so the comma transform is [0]1, 14, 49, 91, 62, ...
%p A367360 Maple code for comma transform (CT(a)) of a sequence a:
%p A367360 # leading digit, from A000030
%p A367360 Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;
%p A367360 CT:=proc(a) local b,i; b:=[];
%p A367360 for i from 1 to nops(a)-1 do
%p A367360 b := [op(b), 10*(a[i] mod 10) + Ldigit(a[i+1])]; od: b; end;
%p A367360 # Inverse comma transform of sequence A calculated in base "bas": - _N. J. A. Sloane_, Jan 03 2024
%p A367360 bas := 10;
%p A367360 Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end;
%p A367360 CTi := proc(A) local B,i,L,R;
%p A367360 for i from 1 to nops(A) do
%p A367360    if A[i]>=bas^2 then error("all terms must have 1 or 2 digits"); fi; od:
%p A367360 B:=Array(1..nops(A),-1);
%p A367360 if A[1] >= bas then B[1]:= Ldigit(A[1]); L:=(A[1] mod bas);
%p A367360 else B[1]:=10; L:=A[1];
%p A367360 fi;
%p A367360 for i from 2 to nops(A) do
%p A367360   if A[i] >= bas then R := Ldigit(A[i]) else R:=0; fi;
%p A367360   B[i] := L*bas + R;
%p A367360   L := (A[i] mod bas);
%p A367360 od;
%p A367360 B;
%p A367360 end;
%p A367360 # second Maple program:
%p A367360 a:= n-> parse(cat(""||(n^2)[-1],""||((n+1)^2)[1])):
%p A367360 seq(a(n), n=0..99);  # _Alois P. Heinz_, Nov 22 2023
%t A367360 a[n_]:=FromDigits[{Last[IntegerDigits[n^2]],First[IntegerDigits[(n+1)^2]]}];
%t A367360 a/@Range[0,83] (* _Ivan N. Ianakiev_, Nov 24 2023 *)
%o A367360 (Python)
%o A367360 from itertools import count, islice, pairwise
%o A367360 def S(): yield from (str(i**2) for i in count(0))
%o A367360 def agen(): yield from (int(t[-1]+u[0]) for t, u in pairwise(S()))
%o A367360 print(list(islice(agen(), 84))) # _Michael S. Branicky_, Nov 22 2023
%o A367360 (Python)
%o A367360 def A367360(n): return (0, 10, 40, 90, 60, 50, 60, 90, 40, 10)[n%10]+int(str((n+1)**2)[0]) # _Chai Wah Wu_, Dec 22 2023
%Y A367360 Cf. A121805, A008959, A002993.
%Y A367360 A166499 is the comma transform of the primes, A367361 of the powers of 2, A367362 of the nonnegative integers. See also A368362.
%K A367360 nonn,base
%O A367360 0,2
%A A367360 _N. J. A. Sloane_, Nov 22 2023